C++ char array read char array as string via cin

Description

C++ char array read char array as string via cin

#include <iostream>
using namespace std;
#include <iomanip.h>
int main()// w ww  .ja va 2s  . c  o m
{
   char first[20], last[20];
   cout << "What is your first name? ";
   cin >> first;
   cout << "What is your last name? ";
   cin >> last;
   cout << "\n\n";     // Prints two blank lines.
   cout << "In a phone book, your name would look like this:\n";
   cout << last << ", " << first;
   return 0;
}



PreviousNext

Related