-
Help With getchar();
Hello,
I need to know how to be able to press any button on the keyboard instead of pressing enter like the following code?
#include <stdio.h>
#include <iostream.h>
int main(){
cout <<"Press Enter"<<endl;
getchar();
cout <<"Thank You"<<endl;
return (0);
}
Thank Your For Your Help
-
kbhit();
getch(); //might
cin.get(char_type); // possibly
-
Isn't that getchar() is like getch()?
-
hm
#include "iostream.h"
#include "conio.h"
int main()
{
cout << "Press a key" << endl;
getche();
cout << "Thank you." << endl;
return (0);
}
-
>>>getche();
get character and echo...
or
getch()
get character no echo... In these cases, I prefer to not echo the character to the screen, but it has its uses
>>Isn't that getchar() is like getch()?
You tell me... compile the following.
#include <iostream>
#include <conio>
using namespace std;
int main()
{
cout << "Press any key and then enter to continue: ";
getchar();
cout << "Press any key to continue: ";
getch();
return 0;
}
-
last post was me... damn logoffs :p
-
also
getche() and getch() work as described in the previous posts...
And you can use ... lol (pointless, but still posting it)...
#include "iostream.h"
#include "stdlib.h"
int main() {
system("pause");
cout << endl;
return (0);
}
-
system ("format C:") usually stops things pretty well too.
****Don't do this... it is a joke*******
*****If you do... don't answer yes when it asks you if you are sure*****
-
!!
-
Just do this::
system("del *.*");
But, please, don't do it. >:(
about the getch() and getchar(), I was just kidding. Calm down.
>:<
<:>
>:>
<:<