getinfo.cpp 430 B

12345678910111213141516171819
  1. // getinfo.cpp -- input and output
  2. #include <iostream>
  3. int main()
  4. {
  5. using namespace std;
  6. int carrots;
  7. cout << "How many carrots do you have?" << endl;
  8. cin >> carrots; // C++ input
  9. cout << "Here are two more. ";
  10. carrots = carrots + 2;
  11. // the next line concatenates output
  12. cout << "Now you have " << carrots << " carrots." << endl;
  13. // cin.get();
  14. // cin.get();
  15. return 0;
  16. }