-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDECAESAR.H
45 lines (28 loc) · 829 Bytes
/
DECAESAR.H
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
#ifndef DECAESAR_H // To make sure you don't declare the function more than once by including the header multiple times.
#define DECAESAR_H
#include<iostream>
#include<fstream>
#include<cctype>
using namespace std;
void DeCaesar(char file1[20],char file2[20])
{
ifstream infile;
ofstream outfile;
int n;
cout << "\nEnter the rot\n";
cin >> n;
infile.open (file1); //opens the file to be encrypted
outfile.open (file2); //opens the output file
char c;
while (!infile.eof()) { //while not the end of the file
infile >> c;
c -= n;
if (c < 'a')
c += 26;
outfile << c;
}
outfile << "\n\n"; //aesthetic purposes
infile.close(); //closes the original file
outfile.close(); //closes the file encryption
}
#endif