U E D R , A S I H C RSS

비밀키/임영동

#include<iostream>
#include<fstream>
#include<string>
using namespace std;

int main()
{
	ifstream fin("input.txt");
	ofstream fout("output.txt");
	string str;
	int key;
	cout<<"키 값을 입력하시오: ";
	cin>>key;
	int count=1;
	while(!fin.eof())
	{
		if(fin.get()=='\n')
			count++;
	}
	fin.close();
	ifstream fin1("input.txt");
	for(int i=0;i<count;i++)
	{
		getline(fin1, str);
		for(string::iterator i=str.begin();i!=str.end();i++)
			(*i)+=key;
		cout<<str<<endl;
		for(i=str.begin();i!=str.end();i++)
			(*i)-=key;
		fout<<str<<endl;
		cout<<"-> "<<str<<endl;
	}
	
	fin1.close();
	fout.close();
	return 0;
}

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:37
Processing time 0.0087 sec