程序清单2.3 getinfo.cpp

// getinfo.cpp -- input and output
#include <iostream>

int main()
{
    using namespace std;

    int carrots;
    cout << "How many carrots do you have?" << endl;
    cin >> carrots;
    cout << "Here are two more.";
    carrots = carrots + 2;
    cout << "Now you have " << carrots << " carrots." << endl;
    return 0;
}

猜你喜欢

转载自blog.csdn.net/m0_38101326/article/details/88043908
2.3