Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

비밀키/김홍선

From ZeroWiki
#include <iostream>
#include <fstream>
using namespace std;

void main()
{
  ifstream fin("xm.txt");
  ofstream fout("out.txt");
  char arr[100];
  int key, count=0, i=0;


  while(!fin.eof())
  {
	  fin.get(arr[i]);
      i++;
      count++;
  }

  cin >> key;

  for(i=0;i<count;i++)
  {
	  int temp = int (arr[i]) + key;
	  arr[i]=char (temp);
	   fout << arr[i];
	   cout << arr[i];
	     }
  cout << endl;
  for(i=0;i<count;i++)
  {
	  int temp = int (arr[i]) - key;
	  arr[i]=char (temp);
	  fout << arr[i];
	  cout << arr[i];
  }



  cout << endl;
}