📄 prog6_06.cpp
字号:
// Program 6.6 Concatenating strings
#include <iostream>
#include <string>
using std::cout;
using std::cin;
using std::endl;
using std::string;
int main() {
string first; // Stores the first name
string second; // Stores the second name
cout << endl << "Enter your first name: ";
cin >> first; // Read first name
cout << "Enter your second name: ";
cin >> second; // Read second name
string sentence = "Your full name is "; // Create basic sentence
sentence += first + " " + second + "."; // Augment with names
cout << endl
<< sentence // Output the sentence
<< endl;
cout << "The string contains " // Output its length
<< sentence.length()
<< " characters."
<< endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -