Advertisement
Spocoman

05. Greeting by Name

Aug 22nd, 2024
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     string name;
  6.     cin >> name;
  7.  
  8.     cout << "Hello, " << name << '!' << endl;
  9.  
  10.     return 0;
  11. }
  12.  
  13. ИЛИ:
  14.  
  15. #include <iostream>
  16. using namespace std;
  17.  
  18. int main() {
  19.     string name;
  20.     cin >> name;
  21.  
  22.     printf("Hello, %s!\n", name.c_str());
  23.  
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement