U E D R , A S I H C RSS

비밀키/노수민

암호화

~cpp 
#include <iostream>
#include <fstream>

using namespace std;
void enpass()
{
	int key,index=-1;
//	cin >> "
	char buffer[300]={0};
	char fileName[10];
	cout << "파일이름 : ";
	cin >> fileName;

	ifstream fin(fileName);
	cout << "키값 : ";
	cin >> key;

	while(fin.get(buffer[++index]))
	{
		cout << char( int(buffer[index]) + key) << " ";
	}
	cout << endl;
}
void depass()
{
	int key,index=-1;
//	cin >> "
	char buffer[300]={0};
	char fileName[10];
	cout << "파일이름 : ";
	cin >> fileName;

	ifstream fin(fileName);
	cout << "키값 : ";
	cin >> key;

	while(fin.get(buffer[++index]))
	{
		cout << char( int(buffer[index]) -n key) << " ";
	}
	cout << endl;

}
int main()
{
	enpass();
	depass();
	return 0;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:38
Processing time 0.0123 sec