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 what handels full name
n^2+7n+15=5 show work please
Why did Pres. Truman believe that political change would come to the Soviet Union?A. The failures of the Soviet Nuclear programB. The Appeal of freedom and the
n^2+7n+15=5 show work please
how do i make 24 using the numbers 11 6 10 2?
how did jazz demonstrate the independent spirit of the times?
What substance is made during transcription and where does it occur
What substance is made during transcription and where does it occur
Pistachios were priced at 3 pounds for $ 6.99. (a) what were the price per pound? (b) how much would 10 pounds of pistachios cost?
A toy rocket is shot vertically into the air from a launching pad 5 feel above the ground with an initial velocity of 80 feet per second. The height h, in feet,