First of all, no... never ever use the method Chococrack mentioned. It is for amateur programmers and a shitty habit to learn. Second... how are you using it? Show me your code.
packetpirate
Junior Poster in Training
60 posts since Jun 2010
Reputation Points: 10
Solved Threads: 3
Skill Endorsements: 0
Fbody
Posting Maven
2,929 posts since Oct 2009
Reputation Points: 833
Solved Threads: 394
Skill Endorsements: 5
n00bs all up in this thread.
cout + cin.get() is all you need in C++
printf() + getchar() is all you need in C
MosaicFuneral
Posting Virtuoso
1,699 posts since Nov 2008
Reputation Points: 888
Solved Threads: 118
Skill Endorsements: 7
#include <stdio.h>
#include <unistd.h>
#include <termios.h>
#include <iostream>
This won't work at all using most compilers. I dare you to try it on VC++. Using O/S and compiler dependent solutions are problematic. These include
* system("pause"); * Any Linux/Unix-only solutions: unistd.h and termios.h * Non-standard C function getch() , defined only in particular compilers on one O/S
The BEST answer is the original post in this thread. Please learn and understand why. Don't just post your favorite inadequate solution as the best way. In these forums we try to teach the proper way to do things, not the hackneyed way most people are taught by less-than-adequate programmers.
More here
Flaming another contributors post is definitely not the way to go about gaining a great reputation here.
There was no flame. The suggestion of system("pause"); is shitty. Nothing against you, just that suggestion.
cout + cin.get() is all you need in C++
printf() + getchar() is all you need in C
printf() is a huge hit on resources. If all you are doing it printing a character or a string, use putchar() and puts() repectively. :icon_wink:
WaltP
Posting Sage w/ dash of thyme
11,404 posts since May 2006
Reputation Points: 3,421
Solved Threads: 1,055
Skill Endorsements: 37
Ah, I've been p0wnd. I submit to your experience.
MosaicFuneral
Posting Virtuoso
1,699 posts since Nov 2008
Reputation Points: 888
Solved Threads: 118
Skill Endorsements: 7