#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()工作,我無法將百科全書()工作之前獲得cin.get()的。運行時,第一個屏幕工作,然後內容菜單工作,子菜單工作,但在顯示實際文本的部分,它不會等待輸入密鑰,然後重新啓動百科全書式功能。Cin.get()不工作我第二次使用它