You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
289 B
C++
20 lines
289 B
C++
5 years ago
|
Read a character using cin
|
||
|
|
||
|
#include <iostream.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
char mychar[100];
|
||
|
int i = 0;
|
||
|
//while the character is not a new line
|
||
|
while((mychar[i] = cin.get()) != '\n')
|
||
|
i++;
|
||
|
|
||
|
mychar[i] = NULL;
|
||
|
//display characters
|
||
|
cout<<mychar<<endl;
|
||
|
|
||
|
return 0;
|
||
|
}
|