Encryption and Decryption of a .txt file with menu

I have been set a challenge at school and i am very confused to make a Encryption and Decryption of a .txt file with menu below is all i have been able to do. any assistance would be apreciated??

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 #include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>
using namespace std;

int main () {
  string line;
  ifstream myfile ("example.txt");
  if (myfile.is_open())
  {

    while(getline(myfile, line)) {
      cout << line << endl;
    }
    myfile.close();
  }

  else cout << "Unable to open file"; 

  void main()
{
    char selection;

    do

    {
        cout << "  Encryption And Decryption Program Menu\n";
        cout << "  ====================================\n";
        cout << "  1.  Encrypt A Message \n";
        cout << "  2.  Decrypt A Message \n";
        cout << "  3.  Exit This Program\n";
        cout << "  ====================================\n";
        cout << "  Enter your selection: ";
        cin >> selection;
        cout << endl;
	
     switch(selection)
	{
         case '1':
                cout << " Encrypt A Message\n";
                cout << "\n";
                break;
		 case '2':
                cout << "Decrypt A Message\n";
                cout << "\n";
                break;
         case '3':
                cout << "Exit The Program\n" ;
                cout << "\n";
                break;
	        default: cout <<selection << "is not a valid menu item.\n";

                cout << endl;
        }

    }while (selection != 0 );

}
Topic archived. No new replies allowed.