I will try to execute the code without using any IDE. I wrote the code in notepad can you tell me how to execute it through command line now?
I will try to execute the code without using any IDE. I wrote the code in notepad can you tell me how to execute it through command line now?
Wrote the code in notepad? Are you nuts?
That is no way to go about programming. If you just don't want the hassle of using the command line, configuring installations to work, yada, yada, then get Visual Studio.
Install. Use. Ctrl+F5 to run. It will keep the console open for you to see.
I can use an IDE, I just like text editors.
Start -> Run -> Open cmdhow to execute it through command line now?
Then you use cd to change to the directory where the program compiled by Dev-C++ is, and then run it using its filename.
The cin.ignore() that was shown in the various articles linked to, and finally in my own posted example, should fix it too, and better in that it is more descriptive and flexible.two cin.get()s should fix it.
I agree, but only because Notepad does not have tools that support programmer productivity. Some other text editors (some of which are almost IDEs unto themselves) do, and these are fine for programming.Wrote the code in notepad? Are you nuts?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
It works now. I have got the latest version of dev. Thanks everyone.
All IDEs should have compile/linking and debugging facilities integrated, otherwise they are not IDEs at all. An editor that integrates those out of the box is actually an IDE. So Visual Studio is not a terrific IDE because it includes them, but because it includes them well.But it's also good to have compile/linking facilities and debugging facilities in the IDE too, in which some editors fail. That's why Visual Studio is such a terrific IDE.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
your code
my codeCode:#include <iostream> int main() { int number1; int number2; int sum; std::cout << "Enter first integer: "; std::cin >> number1; std::cout << "Enter second integer: "; std::cin >> number2; sum = number1 + number2; std::cout << "Sum is " << sum << std::end1; return 0; }
Code:#include <iostream> using namespace std; //eliminates need for std:: int main() { int number1; int number2; int sum; cout << "Enter first integer: "; //because of using namespace std you dont need std cin >> number1; //again no std:: cout << "Enter second integer: "; //no need for std:: cin >> number2; //no need for std:: sum = number1 + number2; cout << "Sum is " << sum << "\n\a"; //no std:: system ("pause"); //pauses program at the end so you can see result return 0; }