C++ cout put() put a newline character to cout

Description

C++ cout put() put a newline character to cout

#include <fstream.h>
void main()//  w  ww .j  a v a 2  s. c  o m
{
   char in_char;      
   char first, last;  
   cout << "What is your first name initial? ";
   cin.get(in_char);  
   first = in_char;
   cin.get(in_char);  
   cout << "What is your last name initial? ";
   cin.get(in_char);  
   last = in_char;
   cin.get(in_char);  
   cout << "\nHere they are: \n";
   cout.put(first);
   cout.put('\n');
   cout.put(last);
   return;
}



PreviousNext

Related