ok well i started out with making my own source code then compiling and running with Dev-C++ and when i run it, its working fine until the last line, here let me past my code
cout << "Thats cool, I used to be in " << mystr << "too.\n";
cout << "Well i'm going to go now, goodbye.";
return0;
}
i know its stupid, i just started and wanted to do something, but ok when i get to the part "what grade are you in << mystr << "? "; and when i enter my grade or w/e the box just closes, is there any way to fix this, would i have to put something like Press "q" to quit or something like that? Any help would be nice, thankyou
Last edited by The Leprechaun; Oct 19th, 2006 at 1:43 am.
run the in a command prompt then ull be able to see all the output before it quits. or try placing system("PAUSE") before the return statement, but i think thats bad practise to do that
run the in a command prompt then ull be able to see all the output before it quits. or try placing system("PAUSE") before the return statement, but i think thats bad practise to do that
Correct .
Its bad practice to use system calls to achieve such a trivial function.
Better use getchar() if using C and cin.get() when using C++.
Yes that and many other things to be considered like the kind of overhead introduced when you call system functions for trivial tasks.
A very good tutorial by my friend and forum member Mr. WaltP can be found here which introduces some of the things which should be avoided. http://www.gidnetwork.com/b-61.html
getline() throws away the \n null character at the end of a string and therefore makes a mess when trying to fluch the buffer. Using cin.get() makes everything much more comfortable
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.