Home | | Schedule | | Assignments | | Lectures | | Resources
//***********************************************************************
// menu.cc
// Author: King/Royden
// Date: February 10, 2014
// Class: CSCI 131
// Purpose: This program allows a user to select a picture from the
// menu to display
// Input: (from standard input) a character
// Output: (to standard output) a picture
//***********************************************************************
#include <iostream>
#include <cstdlib>
void DisplayLion( void );
void DisplayTiger( void );
void DisplayHorse( void );
using namespace std;
int main( void )
{
char animalChoice; // Choice of animal -- Horse, Lion, or Tiger
// Display menu and get input
cout << endl << " MENU" << endl;
cout << "H - Display a horse" << endl;
cout << "L - Display a lion" << endl;
cout << "T - Display a tiger" << endl;
cout << "Enter a menu option: ";
cin >> animalChoice;
cout << animalChoice << endl;
// Decide which animal to display
switch (animalChoice) {
case 'H':
case 'h':
DisplayHorse();
break;
case 'L':
case 'l':
DisplayLion();
break;
case 'T':
case 't':
DisplayTiger();
break;
default:
cout << "ERROR: Bad input character: " << animalChoice << endl;
break;
} // choose which animal to display
return 0;
} // main
//***********************************************************************
// void DisplayLion( void )
// Purpose: To display a picture of a lion
//***********************************************************************
void DisplayLion( void )
{
system("/usr/bin/eog /home/fac/csci131/labs/pictures/lion.jpg");
} // DisplayLion
//***********************************************************************
// void DisplayTiger( void )
// Purpose: To display a picture of a tiger
//***********************************************************************
void DisplayTiger( void )
{
//the Eye of Gnome viewer
system("/usr/bin/eog /home/fac/csci131/labs/pictures/tiger.jpg");
} // DisplayTiger
//***********************************************************************
// void DisplayHorse( void )
// Purpose: To display a picture of a horse
//***********************************************************************
void DisplayHorse( void )
{
system("/usr/bin/eog /home/fac/csci131/labs/pictures/horse.jpg");
//under solaris
//system("/usr/apps/bin/xv -quit /home/fac/csci131/labs/pictures/horse.jpg");
} // DisplayHorse
Home | | Schedule | | Assignments | | Lectures | | Resources
CSCI 131: Techniques of Programming
Last Modified: February 10, 2014
Page Expires: February 10, 2015