From c90888986655bddd374f18a6ede48be0f29e6e20 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Mon, 23 Jan 2017 19:29:40 +0100 Subject: Update crittografia.cc --- crittografia.cc | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'crittografia.cc') diff --git a/crittografia.cc b/crittografia.cc index 5ea70bb..8bf7f4e 100644 --- a/crittografia.cc +++ b/crittografia.cc @@ -1,5 +1,8 @@ #include #include +#include +#include +#include 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; } -- cgit v1.2.3-18-g5258