is it?what really happens if you dont put system("PAUSE")?i heard that if you enter it,then you wont be able to print the output and all...
Printable View
is it?what really happens if you dont put system("PAUSE")?i heard that if you enter it,then you wont be able to print the output and all...
It is not required at all.
- There are (more or less) substitutes for it, some of which are more portable as well.
- You can just run your program via the command line/prompt, as you should do in the first place.
- The need for it disappears if your program is not even meant to be run from the command line/prompt.
oh thanks!Actually i am new to C++ programming.i am a student,and we have a test tomorrow.The examiner cuts marks if you dont put in system("PAUSE")
Well, if the examiner insists, then go ahead and do so, but note that the examiner is misguided.
thanks.Also,what is the difference between the post-increment and pre-increment operator?We were told its the same thing but i have a doubt.....
int n = 10;
int x = n++;
cout << x; // Prints 10
cout << n; // Prints 11
x = ++n;
cout << x; // Prints 12
cout << n; // Prints 12
That should answer your question.
A quick search of the Web reveals Difference between pre-increment and post-increment.Quote:
Also,what is the difference between the post-increment and pre-increment operator?
In that case I must advise you that your teachers are not just misguided, but terribly ignorant, possibly even incompetent. If this is a private course, you would be better off dropping it.Quote:
We were told its the same thing but i have a doubt.....
its a subject in school.And the teacher comes for half an hour one day before the exam and completes the course.If it isnt completed,then its self study.Thats the case this time,so that is exactly why im sitting online surfing tutorials.
In English, post-increment makes a copy of the object with the old value, does the operation, and returns the copy. Pre-increment simply does the operation and returns a reference to the object. So it depends entirely on whether you need the initial value, most of the time. If copying the object is a performance bottleneck, than you know what to avoid...
oh.
what are logical operators?
We actually have a tutorial section on this site. It is not much, some of it is outdated, but at least it is something. In particular, check out the tutorial on if statements. At the bottom it has something to say about the logical operators (or what it calls boolean operators).
Oh wait it does. LOLtomyself
I bet what the examiner is actually requring is that there are pauses in the execution of your code, more so than actually using system("PAUSE"). I betcha I can hack into your computer if you keep using that, and I am not turning to the dark side on anyone here... I am simply pointing out that your programs have an easily exploited security breach in them. Several times per execution, in fact.