C++ cin Get a name in an array, then print it using separate functions.

Description

C++ cin Get a name in an array, then print it using separate functions.

#include <iostream>
using namespace std;
get_name(char name[25]);
print_name(char name[25]);
int main()//from  w w  w . j  ava 2 s  . c o m
{
   char name[25];
   get_name(name);      
   print_name(name);    
   return 0;
}
get_name(char name[25]) 
{
   cout << "What is your first name? ";
   cin >> name;
   return 0;
}
print_name(char name[25])
{
   cout << "\n\n Here you are, " << name;
   return 0;
}



PreviousNext

Related