Assume that a , b and c are char variables has been declared . Write some code that reads in the first character of the next line into a, the first character of the line after that into b and the first character of the line after that into c . Assume that the lines of input are under 100 characters long.

Assume that a , b and c are char variables has been declared . Write some code that reads in the first character of the next line into a, the first character of the line after that into b and the first character of the line after that into c . Assume that the lines of input are under 100 characters long.

LANGUAGE: C++

CHALLENGE:

Assume that a , b and c are char variables has been declared . Write some code that reads in the first character of the next line into a, the first character of the line after that into b and the first character of the line after that into c . Assume that the lines of input are under 100 characters long.

SOLUTION:



cin.ignore(99,'\n');
cin.get(a);
cin.ignore(99,'\n');
cin.get(b);
cin.ignore(99,'\n');
cin.get(c);

Add comment