C Programming Absolute Beginner's Guide (3rd Edition)

(Romina) #1

} else if (choice2 == 3)
{
printf("\n\nUS Presidents in the 1980s:\n");
printf("1980: Jimmy Carter\n");
printf("1981-1988: Ronald Reagan\n");
printf("1989: George Bush\n");
printf("\n\n\n");
break;
} else if (choice2 == 4)
{
exit(1);
} else
{
printf("Sorry, that is not a valid choice!\n");
break;
}
}


// This case is for the 1990s.
// Unlike the top menu, there isn't a data-validation
// do-while loop


case (2):
{
printf("\n\nWhat would you like to see?\n");
printf("1. Baseball\n");
printf("2. The Movies\n");
printf("3. US Presidents\n");
printf("4. Quit\n");


printf("Enter your choice: ");
scanf(" %d", &choice2);


if (choice2 == 1)
{
printf("\n\nWorld Series Champions of ");
printf("the 1990s:\n");
printf("1990: Cincinnati Reds\n");
printf("1991: Minnesota Twins\n");
printf("1992: Toronto Blue Jays\n");
printf("1993: Toronto Blue Jays\n");
printf("1994: No World Series\n");
printf("1995: Atlanta Braves\n");
printf("1996: New York Yankees\n");
printf("1997: Florida Marlins\n");
printf("1998: New York Yankees\n");
printf("1999: New York Yankees\n");
printf("\n\n\n");
break;
} else if (choice2 == 2)
{
printf("\n\nOscar-Winning Movies in ");
printf("the 1990s:\n");
printf("1990: Dances with Wolves\n");
printf("1991: The Silence of the Lambs\n");
printf("1992: Unforgiven\n");
printf("1993: Schindler's List\n");
printf("1996: The English Patient\n");

Free download pdf