// getinfo.cpp
#include <bits/stdc++.h>
using namespace std;
int main()
{
int carrots;
cout << "How many carrots do you have?" << endl;
cin >> carrots;
cout << "Here are two more.";
carrots = carrots + 2;
cout << "Now u have " << carrots << " carrots" << endl;
return 0;
}
与cout类似
可以使用多个cout
拼接你想要的语句,或者一个cout
多个<<
拼接。
cout
就是通过重载<<
来显示字符串。原文:https://www.cnblogs.com/NewBee-CHH/p/11669584.html