#define cstring const int* #end #define string int* #end string concat(cstring a, cstring b) { int la = length(a); int lb = length(b); int* s = new int[la + lb]; for(int i = 0; i < la; i++) { s[i] = a[i]; } for(int i = 0; i < lb; i++) { s[i + la] = b[i]; } return s; } bool compare(cstring a, cstring b) { int l = length(a); if(l != length(b)) { return false; } for(int i = 0; i < l; i++) { if(a[i] != b[i]) { return false; } } return true; } void toLower(string s) { int l = length(s); for(int i = 0; i < l; i++) { int c = s[i]; if(c >= 'A' && c <= 'Z') { c = c - 'A' + 'a'; s[i] = c; } } } void main() { cstring msg = "Hallo User: "; cstring name = "Kajetan"; string together = concat(msg, name); string together2 = concat(together, name); test(together2); toLower(together); test(together); delete together; delete together2; cstring a = name; test(a); test(a == name); cstring baum = "Kajetan"; test(name == baum); test(compare(name, baum)); test(compare(name, "Kajetan")); test(compare(name, "Kajetaa")); }