#include <iostream>
#include <strings.h>
using namespace std;
void encyclopedia()
{
int choice;
int choice2;
system("CLS");
cout << "Content Menu\n\n"
<< "1. Gore\n\n"
<< "2. Wilson\n\n"
<< "3. Costa\n\n"
<< "Selection: ";
cin >> choice;
if (choice == 1)
{
system("CLS");
cout << "Al Gore's Book Summary of:\n\n"
<< "1. Introduction\n\n"
<< "2. \n\n"
<< "3. \n\n";
cin >> choice2;
if (choice2 == 1)
{
system("CLS");
cout << "text here\n\n";
cout << "Press enter to continue\n";
cin.get();
encyclopedia();
}
else if (choice2 == 2)
{
system("CLS");
cout << "text here\n\n";
cout << "Press enter to continue\n";
cin.get();
encyclopedia();
}
else if (choice2 == 3)
{
system("CLS");
cout << "text here\n\n";
cout << "Press enter to continue\n";
cin.get();
encyclopedia();
}
}
if (choice == 2)
{
system("CLS");
cout << "Wilson's Book Summary of:\n\n"
<< "1. Introduction\n\n"
<< "2. \n\n"
<< "3. \n\n";
cin >> choice2;
if (choice2 == 1)
{
system("CLS");
cout << "text here\n\n";
cout << "Press enter to continue\n";
cin.get();
encyclopedia();
}
else if (choice2 == 2)
{
system("CLS");
cout << "text here\n\n";
cout << "Press enter to continue\n";
cin.get();
encyclopedia();
}
else if (choice2 == 3)
{
system("CLS");
cout << "text here\n\n";
cout << "Press enter to continue\n";
cin.get();
encyclopedia();
}
}
if (choice == 3)
{
system("CLS");
cout << "Rebeca Costa's Book Summary of:\n\n"
<< "1. Introduction\n\n"
<< "2. \n\n"
<< "3. \n\n";
cin >> choice;
if (choice2 == 1)
{
system("CLS");
cout << "text here\n\n";
cout << "Press enter to continue\n";
cin.get();
encyclopedia();
}
else if (choice2 == 2)
{
system("CLS");
cout << "text here\n\n";
cout << "Press enter to continue\n";
cin.get();
encyclopedia();
}
else if (choice2 == 3)
{
system("CLS");
cout << "text here\n\n";
cout << "Press enter to continue\n";
cin.get();
encyclopedia();
}
}
}
int main()
{
cout << "2013 Written Task #2\n\nBy: Skye Leis\n\n";
cout << "Press enter to continue\n";
cin.get();
encyclopedia();
}
当我的第一个 cin.get() 工作时,我无法在 encyclopedia() 工作之前让 cin.get() 工作。当它运行时,第一个屏幕工作,然后内容菜单工作,子菜单工作,但在显示实际文本的部分上,它不会等待输入键,然后重新启动百科全书功能。