#include #include #include enum constants { // Ορισμός σταθερών τιμών ITEM= 4, DGR='α'-'Α', DEN='a'-'A' }; /* Ορισμός νέων τύπων δεδομένων */ typedef char *STRING[ITEM]; typedef char *PTR_STR; typedef char BITES8; typedef int BITES16; void Upper(PTR_STR str1, PTR_STR str2); void Lower(PTR_STR str1, PTR_STR str2); main() { STRING str1, str2; STRING tab = {"This example demonstrates how to set the color of the text.", "This example demonstrates how to set the background-color.", "Αυτό το παράδειγμα είναι μια επίδειξη Ελληνικών.", "Συνέχεια του παραδείγματος Ελληνικών.", }; BITES16 i; /* Μετατροπή σε κεφαλαία */ for (i=0; i= 'α') && (str1[i] <= 'ω')) str2[i] = str1[i] - DGR; else if ((str1[i] >= 'a') && (str1[i] <= 'z')) str2[i] = str1[i] - DEN; else str2[i] = str1[i]; } /* Πρόσθεση του τελικού χαρακτήρα */ str2[i] = '\0'; } void Lower(PTR_STR str1, PTR_STR str2) { BITES16 i; for (i=0; str1[i]; i++){ if ((str1[i] >= 'Α') && (str1[i] <= 'Ω')) str2[i] = str1[i] + DGR; else if ((str1[i] >= 'A') && (str1[i] <= 'Z')) str2[i] = str1[i] + DEN; else str2[i] = str1[i]; } /* Πρόσθεση του τελικού χαρακτήρα */ str2[i] = '\0'; }