#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() を取得できません。実行すると、最初の画面が機能し、次にコンテンツ メニューが機能し、サブ メニューが機能しますが、実際のテキストを表示する部分では、エンサイクロペディア機能を再起動する前にエントリ キーを待機しません。