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
- Summer '09
- C++ Programming, #include, standard output