String error on simple text game

Take a look at the program bellow.

[code]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TextAdventureGame
{
class adventure
{
static void Main()
{
string person;
string occupation;
string seaCreature;
string animal;
string friend;
string tool;
string problem;

Console.WriteLine("Simple Adventure Game");

Console.Write("What is your name? ");
person = Console.ReadLine();

Console.Write("What is your occupation? ");
occupation = Console.ReadLine();

Console.Write("Please tell me your favorite animal: ");
animal = Console.ReadLine();

Console.Write("What is the name of your friend? ");
friend = Console.ReadLine();

Console.Write("Name a problem you might face: ");
problem = Console.ReadLine();

Console.Write("Name a tool: ");
tool = Console.ReadLine();

Console.Write("Please give me the name of a sea creature: ");
seaCreature = Console.ReadLine();

Console.WriteLine();
Console.WriteLine();

//write the story
Console.WriteLine("One day there was a person named {0}. Now, {0} was usually ", person);
Console.WriteLine("very content to work as a {0}, but sometimes the job", occupation);
Console.WriteLine("was very difficult.");
Console.WriteLine("One day, {0} discovered that the heardbreak of {1} had ", person, problem);
Console.WriteLine("occured just one time to often. "I can't stand being a ");
Console.WriteLine("{0} any more!" yelled {1}, as he hurled away his ", occupation, person);
Console.WriteLine("{0} in anger, No {1} will keep me from fulfilling", tool, problem);
Console.WriteLine("My dreams! What I really want, said {0}, is to be just like ", person);
Console.WriteLine("{0). Now THAT'S somebody to admire. So {1} put away the ", friend, person);
Console.WriteLine("{0} forever, and followed {1} into the pastoral", tool, friend);
Console.WriteLine("world of {0}-ranching. Eventually, {1} was able to ", animal, person);
Console.WriteLine("retire, as happy as {0}", seaCreature);

Console.WriteLine();
Console.WriteLine();

//Ask for Enter to quite
Console.Write("Press Enter to continue!");
Console.ReadLine();

} //end Main
} //end class
} //end namespace
[/code]

When I compile the program in MS Visual C# 2008 it runs the program until it gets to the line

[code]
Console.WriteLine("{0). Now THAT'S somebody to admire. So {1} put away the ", friend, person);
[/code]

The program does not run after that point and the compiler says that somethings wrong with my string formating. I got this program from the book "Microsoft C# Programming for the absolute beginner"

Can someone please help me out I would really appreciate it. Thanks.

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories