1.1 I/O

Only standard I/O is assumed for reading test data and writing results--no file opening.

<..io-cpp.cxx..>
 #include <iostream>
 using namespace std;
 
 int main() {
       char c;
   while ( cin >> c ){
     cout << c;
   }
   cout << endl;
   return 0;
 }
-_-_-
   g++ -o io-cpp io-cpp.cxx  
   io-cpp < io.data

Fivewordsintwolines.

<..io-func.cxx..>
 #include <iostream>
 using namespace std;
 
 int main() {
       char str[255];
   while ( !cin.eof() ){
     cin.getline( str, 255 );
     cout << str << endl;
   }
   cout << endl;
   return 0;
 }
-_-_-
Five words  
in two lines.  
 

In the default setting, spaces are ignored when characters are read. The following switches can modify the behavior.

<..io-sw.cxx..>
 #include <iostream>
 using namespace std;
 
 int main() {
       char str[255];
   while ( !cin.eof() ){
     cin.getline( str, 255 );
     cout << str << endl;
   }
   cout << endl;
   return 0;
 }
-_-_-
Five words  
in two lines.