alexandradumit5105 alexandradumit5105
  • 03-02-2020
  • Computers and Technology
contestada

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

Respuesta :

frknkrtrn
frknkrtrn frknkrtrn
  • 04-02-2020

Answer:

cin.ignore(100,'\n') >> c;

Explanation:

In order to read data in C language, cin >> variable_name is used. In the question it is also asked that we should read until the next line, assuming the input is under 100 characters long.

If we use cin.ignore(100, '\n'), this will enable us to read until the next line. It will ignore first 100 character, and stop reading data when it reaches '\n' (in this case stopping criteria is being at the end of the line).

Answer Link

Otras preguntas

what color are cigarettes
Karen is 6 years older than Michelle and Michelle is 2 years younger then their brother. The sum of their ages is 62 how old is michelle
How did people use constellations to decide when to plant crops
Explain why Britain's policy of appeasement failed to prevent the German expansion from 1937 to the takeover of Czechoslovakia in March 1939.
Patrick ate 3/5 of a small pizza. For lunch Saturday he4 ate 1/2 of the leftover pizza. How much pizza did he eat for lunch on Saturday?
Karen is 6 years older than Michelle and Michelle is 2 years younger then their brother. The sum of their ages is 62 how old is michelle
What present day countries control territory that was controlled by the Seleucid empire?
what are the four requirements for life?
what are some similarities for weathering and erosion
how did supporters view the storming of the bastille