#include <iostream>
#include <string>
int main(void)
{
using std::cout;
using std::cin;
using std::string;
string name;
int n1, n2;
cout << "What is your name ?\n";
cin >> name;
cout << "Hello " << name.c_str() <<"!\n"
<< "Please give me two number separated by space\n";
cin >> n1 >> n2;
cout << "Sum of " << n1 << " + " << n2 << " is " << n1 + n2 << "\n";
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我的控制台输入/输出如下所示:
你叫什么名字 ?
约翰托特
你好约翰! …