This preview shows page 1. Sign up to view the full content.
Unformatted text preview: int number = 0; // Variables work the same as they did in C // You'll see that the syntax between C and C++ is the same // the difference come in with what we can do in C++, there // are some new keywords, and programming constructs and // variable types std::cout << "Give " << "me " << "an " << "integer: "; std::cin >> number; // cin stands for console input, it works the same as cout // just in the opposite direction, notice that we are using // greater than signs this time. // Just imagine them as arrows pointing in the direction // that the data will be going to std::cout << "Your number is: " << number << "\nTwice that number is: " << number * 2 << std::endl; return 0; } /* Hello World Give me an integer: 5 Your number is: 5 Twice that number is: 10 Press any key to continue . . . */...
View Full Document
This note was uploaded on 10/05/2011 for the course CS 37 taught by Professor Glenncuevas during the Summer '09 term at Irvine Valley College.
- Summer '09
- C++ Programming