O'Reilly logo

SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION by Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using an Input Stream

If you are using an Integrated Development Environment (IDE), such as Borland's C++Builder or Microsoft's Visual C++, you may find that running the example creates a window where the result (if any) is displayed, and the window almost instantly disappears when the program stops running. If that happens, you'll need to make the program pause before it ends to see whether the output is what you expect.

Even if you are running your programs directly from the command line of a DOS or shell window, you will find the following code interesting, as it lets the program get information from the user.

 1: #include <iostream> 2: 3: using namespace std; 4: 5: int main(int argc, char* argv[]) 6: { 7: cout << ((6/2)+3) << endl; *8: *9: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required