Write a program that reads from the standard input into a whole line time, and then modify the program so it reads a word.

string line;
	while (getline(cin, line))
		if (!line.empty())
			cout << line << endl;

	string line;
	while (cin>>line)
		if (!line.empty())
			cout << line << endl;

  

Guess you like

Origin www.cnblogs.com/lIllIll/p/11717368.html