// echoFor.cpp
// Echoes lines of text typed by the user,
// until the user types Ctrl-C to quit.
//
// Run this program and understand how it works.
// Then re-write as equivalent nested while loops.
//
// In the heading of the inner loop,
// '\n' is the newline character, used as
// end-of-line marker on Unix systems.
// (On Windows systems, the end-of-line
// marker would consist of a carriage
// return, '\r', followed by newline.)
#include <iostream>
using namespace std;
int main()
{
cout << "Type a few lines of text, "
<< "then Ctrl-C to quit:" << endl;
char letter;
for ( cin.get(letter) ; ; cin.get(letter) )
{
cout << "You tuped: ";
for ( ; letter != '\n'; cin.get(letter) )
cout << letter;
cout << endl;
cout << "Type another line (or Ctrl-C to quit):" << endl;
} // for
} // function main