No older revisions available
No older revisions available
HASH구하기/권정욱,곽세환 ¶
~cpp
#include <iostream>
#include <fstream>
using namespace std;
int main(){
char secret[30];
cout << "확인할 텍스트를 입력하세요 : ";
cin >> secret;
ifstream fin(secret);
ofstream fout("hash_enc.txt");
char identi[20][5];
int sum_ascii[5] = {0,0,0,0,0};
for (int i = 0; i<20; i++){
for (int j = 0; j<5; j++){
identi[i][j] = '\0';
}
}
for (i = 0; i<20; i++){
for (int j = 0; j<5; j++){
fin.get(identi[i][j]);
if (fin.eof())
break;
}
if (fin.eof())
break;
}
for (int j = 0; j<5; j++){
for (i = 0; i<20; i++){
if (identi[i][j] != '\0') sum_ascii[j] += identi[i][j];
}
}
for (i = 0; i < 5 ; i++)
cout << sum_ascii[i] << " ";
cout << endl;
return 0;
}