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

Find the x-intercept for the line represented by this equation.
From when to when did the slave trade happen
The height of the triangle is 13/2 cm and the base is 6cm find the area of the triangle
Why did rutherford conclude that an atom nucleus has a positive charge instead of a negative charge?
Darryl earns a gold star every week he is good at school (a school week is 5 days). At the end of the grading period he has 3 gold stars. How many days was he g
When metal atoms combine chemically with atoms of other elements, what do they usually do?
use physical feature in a sentence
Country names that can be spelled two ways
Given that unit cost = $25, annual carrying charge = 10%, annual demand = 4000 units and ordering cost = $15 per order, the eoq is:
What is the inverse of the given function? y = 7x2 -­ 3?