Q:

Write a program to read the standard input a line at a time. Modify your program to read a word at a time

0

Write a program to read the standard input a line at a time. Modify your program to read a word at a time.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>
#include <string>

void read_lines() {
  std::string line;
  while (getline(std::cin, line))
    std::cout << line << std::endl;
}

void read_words() {
  std::string word;
  while (std::cin >> word)
    std::cout << word << std::endl;
}

int main() {
  //read_lines();
  //read_words();

  return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now