Okay, I have written programs using dev-c++ with the console programming part. The problem is that the kill command is ENTER, so when I ask for a variable, I type it, and I hit ENTER, to input it, it kills the application, I was wondering if there was a way to change the kill command
Question about console programmin
Started by Danerd100, Nov 19 2007 07:24 PM
4 replies to this topic
#1
Posted 19 November 2007 - 07:24 PM
|
|
|
#2
Posted 20 November 2007 - 09:26 AM
#3
Posted 20 November 2007 - 01:40 PM
Here is an example of the code
[HIGHLIGHT="C++"]#include <iostream>
using namespace std;
int main ()
{
string Name;
cout << "What Is Your Name?" << endl;
cin >> Name;
cout << "Hi" << Name;
return 0;
}
[/HIGHLIGHT]
But it doesn't work, no matter how I make it, anytime I prompt for something, it closes when i press enter to submit it
[HIGHLIGHT="C++"]#include <iostream>
using namespace std;
int main ()
{
string Name;
cout << "What Is Your Name?" << endl;
cin >> Name;
cout << "Hi" << Name;
return 0;
}
[/HIGHLIGHT]
But it doesn't work, no matter how I make it, anytime I prompt for something, it closes when i press enter to submit it
#4
Posted 20 November 2007 - 02:00 PM
hmm :) it's simple
after 10 line insert
example
[highlight="c++"]#include <iostream>
using namespace std;
int main ()
{
string Name;
cout << "What Is Your Name?" << endl;
cin >> Name;
cout << "Hi " << Name << endl; // i added new line
system("pause"); // added this option
return 0;
}
[/highlight]
after 10 line insert
system("pause"); // after it there is return 0;
example
[highlight="c++"]#include <iostream>
using namespace std;
int main ()
{
string Name;
cout << "What Is Your Name?" << endl;
cin >> Name;
cout << "Hi " << Name << endl; // i added new line
system("pause"); // added this option
return 0;
}
[/highlight]
THink positive :)
#5
Posted 20 November 2007 - 02:24 PM
Thank you very much, it works now


Sign In
Create Account


Back to top









