Ask Question

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.

+3
Answers (1)
  1. 26 April, 06:56
    0
    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).
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “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 ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers