Advertisement
P22DX

a.cpp

Jan 17th, 2020
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.45 KB | None | 0 0
  1. /**
  2.  * File: a.cpp
  3.  * Author: Cvar1984 <gedzsarjuncomuniti@gmail.com>
  4.  * Date: 18.01.2020
  5.  * Last Modified Date: 18.01.2020
  6.  * Last Modified By: Cvar1984 <gedzsarjuncomuniti@gmail.com>
  7.  */
  8. #include <iostream>
  9. #include <string>
  10. #include <stdio.h>
  11. #include <ctype.h>
  12.  
  13. using namespace std;
  14.  
  15.  
  16. char name1[50];
  17. char name2[50];
  18. char date[50];
  19. char address[50];
  20. char school[50];
  21. char yn;
  22. bool correct = false;
  23.  
  24. int getUserInformations() {
  25.     cout <<"Enter your first name: ";  
  26.     cin >> name1;
  27.     cout <<"Enter your last name: ";
  28.     cin >> name2;
  29.     cout <<"Enter your date of birth: ";
  30.     cin >> date;
  31.     cout << "Enter your address: ";
  32.     cin>>address;
  33.     cout << "Enter your school: ";
  34.     cin >> school;
  35.     cout << endl;
  36.  
  37.     strcat(name1, " ");
  38.     cout<<"this is your date: "<<endl;
  39.     cout<<"your name: ";
  40.     strcat(name1, "");
  41.     cout<<""<<strcat(name1, name2)<<endl;
  42.     cout <<"your date of birth: "<<date<<endl;
  43.     cout <<"Your address: "<<address<<endl;
  44.     cout <<"Your school: "<<school<<endl;
  45.     cout <<""<<endl;
  46.     cout<<"the data is correct (y/N) ?  ";
  47.     cin>>yn;
  48.     cout<<endl;
  49.     if(yn=='N' || yn=='n') {
  50.         correct = false;
  51.     }
  52.     else if(yn=='Y' || yn=='y') {
  53.         correct = true;
  54.     }
  55.     else {
  56.         correct = false;
  57.     }
  58.     return correct;
  59. }
  60. int main() {
  61.     while(1) {
  62.         if(getUserInformations() == true) {
  63.             break;
  64.         }
  65.     }
  66.     return 0;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement