U E D R , A S I H C RSS

개인키,공개키/박진영,김수진,나휘동

개인키 : 70, 공개키 : 186
~cpp 
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
	ifstream fin("source.txt");
	ofstream fout("source_enc.txt");

	int key = 70;
	char ch;
	int result, result1;
	while(fin.eof() != true)
	{
		fin >>ch;
		result = int(ch) + key;
		result1 = result%255;
		fout <<char(result1);
	}

	return 0;

}





#include <iostream>
#include <fstream>
using namespace std;
int main()
{
	ifstream fin("source_enc.txt");
	ofstream fout("source1.txt");
    int key1;
	cin >> key1;
    int key = 256-key1;
	char ch;
	int result;
	while(fin.eof() != true)
	{
		fin >>ch;
		result = int(ch) - key;
	if (result>=0 && result<=184)
		fout <<char(result);
	else   
	    fout <<char(result+255);
	}

	return 0;
}






Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:40
Processing time 0.0134 sec