1
0

carrots.cpp 556 B

123456789101112131415161718192021
  1. // carrots.cpp -- food processing program
  2. // uses and displays a variable
  3. #include <iostream>
  4. int main()
  5. {
  6. using namespace std;
  7. int carrots; // declare an integer variable
  8. carrots = 25; // assign a value to the variable
  9. cout << "I have ";
  10. cout << carrots; // display the value of the variable
  11. cout << " carrots.";
  12. cout << endl;
  13. carrots = carrots - 1; // modify the variable
  14. cout << "Crunch, crunch. Now I have " << carrots << " carrots." << endl;
  15. // cin.get();
  16. return 0;
  17. }