示例#1
0
int main(){
  Critter crit;
  crit.Talk();
  int choice;
  do{
	system("clear");
	cout << "\nCritter Caretaker\n\n";
	cout << "0 - Quit\n";
	cout << "1 - Listen to your critter\n";
	cout << "2 - Feed your crettir\n";
	cout << "3 - Play with your critter\n";
	cout << "Choice: ";
	cin >> choice;
	switch(choice)
	{
	  case 0:
	    cout << "Good-bye.\n";
	    break;
	  case 1:
	    crit.Talk();
	    break;
	  case 2:
	    crit.Eat();
	    break;
	  case 3:
	    crit.Play();
	    break;
	  default:
	    cout << "\nSorry.but " << choice << " isn`t a valid choice.\n";
	}
	usleep(3000000);
    } while (choice !=0);
  return 0;
}
示例#2
0
文件: main.cpp 项目: JustinMorritt/C-
int main()
{
	Critter crit;
	unsigned choice;
	
	do
	{
		choice = askForInt(MENU, 4,0);
		//std::cout << "Current Mood: " << crit.GetMood() << std::endl;
		switch(choice)
		{
			case 0:
				std::cout << "Good Bye!\n";
				break;
			case 1:
				crit.Talk();
				break;
			case 2:
				crit.Eat();
				break;
			case 3:
				crit.Play();
				break;
			case 4:
				crit.PerformTrick();
				break;
		}
	}while(choice != 0);
	
return 0;
}
示例#3
0
int main () {
    srand(static_cast<unsigned int>(time(0)));

    Critter crit;

    int choice;

    do {
        cout << endl << "Critter Caretaker" << endl;
        cout << "-----------------" << endl << endl;
        cout << "0 - Quit" << endl;
        cout << "1 - Listen to your critter" << endl;
        cout << "2 - Feed your critter" << endl;
        cout << "3 - Play with your critter" << endl;
        cout << "4 - Ask your critter to perform a trick." << endl << endl;

        cout << "Choice: ";
        cin >> choice;

        switch (choice) {
            case 0:
                cout << "Good-bye." << endl;
                break;
            case 1:
                crit.Talk();
                break;
            case 2:
                crit.Eat();
                break;
            case 3:
                crit.Play();
                break;
            case 4:
                crit.PerformTrick();
                break;
            default:
                cout << "Sorry, but " << choice << " isn't a valid choice." << endl;
                break;
        }
    } while (choice != 0);

    return 0;
}
示例#4
0
int main() {
    Critter crit;
    
    crit.Talk();
    
    int choice = -1;
    
    while(choice != 0) {
        printInstructions();
        
        cout << "Choice: ";
        cin >> choice;
        cout << "\n";
        
        switch(choice) {
            case 0:
                cout << "Good bye.\n";
                break;
            case 1:
                crit.Talk();
                break;
            case 2:
                crit.Eat();
                break;
            case 3:
                crit.Play();
                break;
            default:
                cout << "\nSorry, but " << choice << " isn't a valid choice.\n";
                break;
        }
    }
    
    
    return 0;
}