Advertisement
apl-mhd

string input

Jan 25th, 2019
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstring>
  4. #include <cctype>
  5. using namespace std;
  6.  
  7.  
  8. int main() {
  9.  
  10.  
  11.     //line of string input
  12.    // char input[100];
  13.    // cin.getline(input,sizeof(input));
  14.    string name;
  15.     char name3[100];
  16.  
  17.  
  18.  
  19.    while(true){
  20.  
  21.        cout << "Enter:" << endl;
  22.  
  23.        getline(cin, name);
  24.  
  25.  
  26.        cout << "Enter:" << endl;
  27.        cin.getline(name3, sizeof(name3));
  28.  
  29.        if (name.compare(name3) == 0)
  30.            cout << "equal" << endl;
  31.  
  32.        //stdin(flsh);
  33.  
  34.    }
  35.  
  36.  
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement