Advertisement
Guest User

Untitled

a guest
May 24th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.09 KB | None | 0 0
  1. //5/21/2019
  2. //Module 08
  3.  
  4. #include <iomanip>
  5. #include <string>
  6. #include <iostream>
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.    
  12.  
  13.    
  14.     cout << "Hello, welcome to name input machine" << endl;
  15.  
  16.     cout << "Please enter a first, middlw, and last name " << endl;
  17.    
  18.  
  19.     const int Name_length = 32;                                                                         //gathers first, middle, and last names
  20.     char first_name[Name_length], middle_name[Name_length], last_name[Name_length];
  21.    
  22.     cout << "plz enter first name" << endl;
  23.  
  24.     cin.getline( first_name, Name_length - 1);
  25.  
  26.  
  27.     cout << "Please enter middle name " << endl;
  28.    
  29.     cin.getline(middle_name, Name_length - 1);
  30.  
  31.     cout << "Please enter last name" << endl;
  32.  
  33.     cin.getline(last_name, Name_length - 1);
  34.  
  35.    
  36.     char Full_name[Name_length * 3]; //compiles the names together
  37.  
  38.     strcat_s(Full_name, last_name);
  39.     strcat_s(Full_name, " ");
  40.     strcat_s(Full_name, first_name);
  41.     strcat_s(Full_name, " ");
  42.     strcat_s(Full_name, middle_name);
  43.     cout << Full_name << endl;                      //end product
  44.    
  45.  
  46.     system("pause");                                                //Pauses the program for the user to look at the data
  47.     return 0;
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement