Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Microsoft CSharp Programming For The Absolute Beginner (2002) [eng]-1.pdf
Скачиваний:
46
Добавлен:
16.08.2013
Размер:
15.71 Mб
Скачать

Chapter 1: Basic Input and Output: A Mini Adventure

Programming is not something you learn by reading. You learn programming only by writing programs. In this chapter, you get started by writing a simple (silly) adventure game. You also get the basic concepts behind programming in general and C# in particular. In addition to learning how C# is organized, you learn how to

Write the simplest interface for a C# console program.

Write data to the screen.

Get information from the user.

Create basic variables.

Project: The Mini Adventure

The game at the end of this chapter is simple but fun. Showing you the game in progress is easier than describing it, so take a look at Figures 1.1 and 1.2, which show the game in progress. The computer asks the user a few questions and then makes a silly story based on the user responses.

Figure 1.1: The game begins by asking the user a few questions.

Figure 1.2: The user’s answers result in a silly story.

You can see that the game asks the user questions and then incorporates the answers to create a silly story. This game probably won’t sell a million copies, but it’s quite impressive for a first

5

Соседние файлы в предмете Программирование на C++