CPP   43

strings

Guest on 20th April 2022 02:00:14 AM

  1. // For C++ libraries.
  2. #include <iostream>
  3.  
  4. // Library for strings.
  5. #include<string>
  6.  
  7. using namespace std;
  8.  
  9. int main() {
  10.     string name;
  11.  
  12.     cout << "What is your name?: ";
  13.     getline(cin,name);
  14.  
  15.     if(name=="Lawrence" || name=="lawrence" || name=="Larry" || "larry")
  16.         cout << "Hey " << name << ", that's my name too!" << endl;
  17.     else
  18.         cout << "Hello " << name << endl;
  19.     return 0;
  20.  
  21. }

Raw Paste


Login or Register to edit or fork this paste. It's free.