summaryrefslogtreecommitdiff
path: root/crittografia.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crittografia.cc')
-rw-r--r--crittografia.cc64
1 files changed, 64 insertions, 0 deletions
diff --git a/crittografia.cc b/crittografia.cc
new file mode 100644
index 0000000..5ea70bb
--- /dev/null
+++ b/crittografia.cc
@@ -0,0 +1,64 @@
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+void converti(char *str, int size);
+
+char consonantiMin[] = {'b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','z'};
+char consonantiMax[] = {'B','C','D','F','G','H','J','K','L','M','N','P','Q','R','S','T','V','W','X','Z'};
+
+int main()
+{
+ char test[] = "IT Archimede Catania";
+
+ converti(test, sizeof test);
+
+ return 0;
+}
+
+void converti(char *str, int size)
+{
+ bool cpres = false;
+ for(int i = 0; i < size-1; i++){
+ int s = 1;
+ if(str[i] == 'a') str[i] = 'e';
+ else if(str[i] == 'e') str[i] = 'i';
+ else if(str[i] == 'i') str[i] = 'o';
+ else if(str[i] == 'o') str[i] = 'u';
+ else if(str[i] == 'u') str[i] = 'y';
+ else if(str[i] == 'y') str[i] = 'a';
+ else if(str[i] == 'A') str[i] = 'E';
+ else if(str[i] == 'E') str[i] = 'I';
+ else if(str[i] == 'I') str[i] = 'O';
+ else if(str[i] == 'O') str[i] = 'U';
+ else if(str[i] == 'U') str[i] = 'Y';
+ else if(str[i] == 'Y') str[i] = 'A';
+ else if(str[i] == 'z') str[i] = 'b';
+ else if(str[i] == 'Z') str[i] = 'B';
+ else if(str[i] == '0') str[i] = '1';
+ else if(str[i] == '1') str[i] = '2';
+ else if(str[i] == '2') str[i] = '3';
+ else if(str[i] == '3') str[i] = '4';
+ else if(str[i] == '4') str[i] = '5';
+ else if(str[i] == '5') str[i] = '6';
+ else if(str[i] == '6') str[i] = '7';
+ else if(str[i] == '7') str[i] = '8';
+ else if(str[i] == '8') str[i] = '9';
+ else if(str[i] == '9') str[i] = '0';
+ else {
+ for(unsigned int j = 0; j < sizeof consonantiMin; j++){
+ if(str[i] == consonantiMin[j] || str[i] == consonantiMax[j]){
+ cpres = true;
+ if(str[i]+1 == 'A' || str[i]+1 == 'E' || str[i]+1 == 'I' || str[i]+1 == 'O' || str[i]+1 == 'U' || str[i]+1 == 'Y'
+ || str[i]+1 == 'a' || str[i]+1 == 'e' || str[i]+1 == 'i' || str[i]+1 == 'o' || str[i]+1 == 'u' || str[i]+1 == 'y') s = 2;
+ else s = 1;
+ }
+ }
+ }
+ if(cpres == true) str[i]+=s;
+ cpres = false;
+ }
+
+ cout << str << endl;
+}