summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanto Cariotti <sancn@live.com>2017-01-23 19:29:40 +0100
committerGitHub <noreply@github.com>2017-01-23 19:29:40 +0100
commitc90888986655bddd374f18a6ede48be0f29e6e20 (patch)
tree41b1116f887008c0332df333bf6a4552a092d54e
parenta3d045944e3f96a8e7234f5cd0fc089dab5c89e3 (diff)
Update crittografia.cc
-rw-r--r--crittografia.cc32
1 files changed, 27 insertions, 5 deletions
diff --git a/crittografia.cc b/crittografia.cc
index 5ea70bb..8bf7f4e 100644
--- a/crittografia.cc
+++ b/crittografia.cc
@@ -1,5 +1,8 @@
#include <iostream>
#include <string>
+#include <sstream>
+#include <fstream>
+#include <cstring>
using namespace std;
@@ -10,10 +13,31 @@ char consonantiMax[] = {'B','C','D','F','G','H','J','K','L','M','N','P','Q','R',
int main()
{
- char test[] = "IT Archimede Catania";
+ ifstream in;
+ ofstream out;
+
+ in.open("input.txt");
+ out.open("output.txt");
+
+ string num;
+ int N;
+ string ca;
+
+ getline(in, num);
+ istringstream(num) >> N;
+
+ for(int i = 0; i < N; i++){
+ getline(in, ca);
+ char *c = new char[ca.length() + 1];
+ strcpy(c, ca.c_str());
+ converti(c, ca.length() + 1);
+ out << c << endl;
+ delete[] c;
+ }
+
+ in.close();
+ out.close();
- converti(test, sizeof test);
-
return 0;
}
@@ -59,6 +83,4 @@ void converti(char *str, int size)
if(cpres == true) str[i]+=s;
cpres = false;
}
-
- cout << str << endl;
}