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

Which elements in a set below are integers?12,-3/4,5,-7,2.24,14/7,9
12. The Greeks were known as the first astronomers. A.true B.false It’s true
Identify examples and non-examples of the standard form of a linear function. 5x - 3y = 9 y = 1/2x - 3 2x + 3y = 0 x + y = 1 x = 6y y = x - 2 Which are examples
Explain how carbon dioxide moves from one organism to another
There are 7 times as many female students as male students at a university. What fraction of the university are female
The graph of the function f(x) =4 square root x is shown. what is the domain of the function?
please help with this two thank you
I have 10 minutes left I need help right now !
Read the sentence below: Soil is to a gardener as oil is to a landscape painter. Which literary device is used in this sentence? O Allusion Analogy Hyperbole Me
15 POINTS FOR ANYONE WHO CAN ANSWER THIS!!!!!! plZ