What wrong with this code
This code is supposed to work but it doesn''t every time i start the program it shuts off how can i fix it?
#include <iostream.h>
int main()
{
cout<<"hello i am rookie developers first program";
return 0;
}
Thanks for reading my post
please help
if I need help, alot of help;
goto forum
The program ends without waiting for a response from the user. If you ran that from the command prompt, you would see your text.
LMFAO
#include <iostream.h>
//use the header conio.h for getch()
#include <conio.h>
int main()
{
cout<<"hello i am rookie developers first program";
//Use getch to get a response from the user to quit
//So basicly it will pause and once the user presses a button
//the program will close but you can read everything before that
getch();
return 0;
}
#include <iostream.h>
//use the header conio.h for getch()
#include <conio.h>
int main()
{
cout<<"hello i am rookie developers first program";
//Use getch to get a response from the user to quit
//So basicly it will pause and once the user presses a button
//the program will close but you can read everything before that
getch();
return 0;
}
Your code is working but cause it''s in a DOS window it displays it and then closes the window so fast that you don''t see it. Try adding this after your cout statement:
cin.get()
You could also try to call up a DOS window and just execute it from there and it then won''t close the window for ya.
cin.get()
You could also try to call up a DOS window and just execute it from there and it then won''t close the window for ya.
i tried both of those things and neither worked i even copied the example but it didnt even work. im am using devC++ is there something wrong with my compiler
if I need help, alot of help;
goto forum
if I need help, alot of help;
goto forum
Try this:
[edited by - Mscgamer on June 16, 2003 4:49:26 PM]
#include <iostream.h>#include <stdlib.h> // Add this so you can use system("PAUSE")int main(){ cout<<"hello i am rookie developers first program"; system("PAUSE"); return 0;}
[edited by - Mscgamer on June 16, 2003 4:49:26 PM]
Any of these three should work:
[ Google || Start Here || ACCU || MSDN || STL || GameCoding || BarrysWorld || E-Mail Me ]
#include <iostream>#include <cstdlib> int main(){ std::cout << "I am rookie_developer''s first program!\n\n"; system("PAUSE"); return 0;}
#include <iostream> int main(){ std::cout << "I am rookie_developer''s first program!\n\n" << "Press any key to continue . . . "; std::cin.get(); return 0;}
#include <iostream>#include <conio.h> int main(){ std::cout << "I am rookie_developer''s first program!\n\n"; getch(); return 0;}
[ Google || Start Here || ACCU || MSDN || STL || GameCoding || BarrysWorld || E-Mail Me ]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement