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 value of each trigonometric ratio
Iris Setosa is a beautiful wildflower that is found in such diverse places as Alaska, the Gulf of St. Lawrence, much of North America, and even English meadows
Betty tosses a fair coin 40 times. The coin lands on head 17 times and lands on tail 23 times. What is the probability and relative frequency of the coin landin
the attractive force that acts between atoms
Does Othello’s jealousy allow him to plead insanity?
Nancy use 2 / 3 of a cup of tomatoes for the one cup of tomato paste if she makes 5 cups of tomato paste how many cups of tomatoes will she make
Benefits about having personal finance
ways to reduce coal mining damages​
x < -5. solve plssss no links​
When you use the distance formula, you are building a right triangle, the of which goes between two given points. O A. base O B. hypotenuse O C. angle D. leg