程序清单2.2 carrot.cpp

// carrots.cpp -- food processing program
// uses and displays a variable

#include <iostream>

int main()
{
    using namespace std;

    int carrots;

    carrots = 25;
    cout << "I have ";
    cout << carrots;
    cout << " carrots.";
    cout << endl;

    carrots = carrots - 1;

    cout << "Crunch, crunch. Now I have " << carrots << " carrots." << endl;

    return 0;
}

猜你喜欢

转载自blog.csdn.net/m0_38101326/article/details/88043890
2.2
cpp