< Previous | Contents | Next >
The classic first task a programmer tackles in a new language is the Hello World program, which displays Hello World on the screen. The Game Over program
6 Chapter 1 n Types, Variables, and Standard I/O: Lost Fortune
puts a gaming twist on the classic and displays Game Over! instead. Figure 1.2 shows the program in action.
Figure 1.2
Your first Cþþ program displays the two most infamous words in computer gaming.
You can download the code for this program from the Course Technology website (www.courseptr.com/downloads). The program is in the Chapter 1 folder; the filename is game_over.cpp.
Hi n t
You can download all of the source code for the programs in this book by visiting www. courseptr.com/downloads and searching for this book. One way to search is by ISBN (the book's identification number), which is 1435457420.
// Game Over
// A first Cþþ program
#include <iostream> int main()
{
std::cout << "Game Over!" << std::endl; return 0;
}
Writing Your First Cþþ Program 7