Code:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
cout << "Willkommen zu meinem Programm!\n\n";
char choice;
do {
//User Prompt
cout << "Please Choose a Selection from the Menu.\n\n";
//Display Menu
cout << "1) Program Languages and their uses\n2) Different Programming Paradigms\n3) Different C++ Features and their uses \n4) Exit\n\n";
cin >> choice;
cout << endl;
if (choice == '1')
{
//Read the file
ifstream infile;
ofstream outfile;
//Open the File
infile.open("ProgrammingLanguages.txt", ios::in);
//Ensure File exists
if (!infile)
{
cout << "File does not exist!\n\n";
}
//Close the file
infile.close();
}
if (choice == '2')
{
//Read the file
ifstream infile;
ofstream outfile;
//Open the File
infile.open("ProgrammingParadigms.txt", ios::in);
//Ensure File exists
if (!infile)
{
cout << "File does not exist!\n\n";
}
//Close the file
infile.close();
}
if (choice == '3')
{
//Read the file
ifstream infile;
ofstream outfile;
//Open the File
infile.open("C++Features.txt", ios::in);
//Ensure File exists
if (!infile)
{
cout << "File does not exist!\n\n";
}
//Close the file
infile.close();
}
else if (choice == '4')
{
//Tell user to have nice day
cout << "A thousand blessings upon you and your family.\n";
cin.get();
cin.ignore();
}
} while (choice != '4');
return 0;
}
Comment