dimanche 30 avril 2017

How to set build and run C++ code in Sublime Text with allowing cin>> inputs?

I use Sublime Text 3 editor in Ubuntu and I hate to use the command line g++ program.cpp -o program in order to compile and run my programs. Because of this reason I used sublime script builder

{
    "shell_cmd": "g++ -std=c++11 \"${file}\" -o \"${file_path}/${file_base_name}\"",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++",

    "variants":
    [
        {
            "name": "Run",
            "shell_cmd": "g++ -std=c++11 \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
        }
    ]
}

from these site http://ift.tt/2oUA09K

It works but and I can see the result on the bottom console of the editor, the problem is that I can't use cin>> or scanf() inputs to insert the values on the bottom console, - I have to initialize the variables explicitly inside the code. What should I do or which package I have to install in order to read variables from the keyboard ? thank you.

Aucun commentaire:

Enregistrer un commentaire