FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!

euroeng.c [Pt. 2]




//Convert English to Euro-English
hover = head;
int count = 1;

while(hover->next != NULL) {
if(toupper(hover->ch) == 'C') {
if(toupper(hover->next->ch) == 'E' || toupper(hover->next->ch) == 'I' || toupper(hover->next->ch) == 'Y') {
hover->ch = (isupper(hover->ch) > 0) ? 'S' : 's';
}
else {
hover->ch = (isupper(hover->ch) > 0) ? 'K' : 'k';
}
}
else if(toupper(hover->ch) == 'W') {
hover->ch = (isupper(hover->ch) > 0) ? 'V' : 'v';
}
else if(toupper(hover->ch) == 'P' && toupper(hover->next->ch) == 'H') {
hover->ch = (isupper(hover->ch) > 0) ? 'F' : 'f';
deleteNode(hover->next);
}
else if(toupper(hover->ch) == toupper(hover->next->ch)) {
deleteNode(hover->next);
}
else if((toupper(hover->ch) == 'E' && hover->next->ch == ' ') && count > 3) {
deleteNode(hover);
count = 1;
}
else if(toupper(hover->ch) == 'T' && toupper(hover->next->ch) == 'H') {
hover->ch = (isupper(hover->ch) > 0) ? 'Z' : 'z';
deleteNode(hover->next);
}
else if(toupper(hover->ch) == 'O' && toupper(hover->next->ch) == 'U') {
hover->ch = (isupper(hover->ch) > 0) ? 'U' : 'u';
deleteNode(hover->next);
}
else if(toupper(hover->ch) == 'E' && toupper(hover->next->ch) == 'A') {
hover->ch = (isupper(hover->ch) > 0) ? 'E' : 'e';
deleteNode(hover->next);
}
else if((toupper(hover->ch) == 'E' && toupper(hover->next->ch) == 'D') && hover->next->next->ch == ' ') {
hover->ch = (isupper(hover->ch) > 0) ? 'D' : 'd';
deleteNode(hover->next);
}
else if(hover->next->ch == ' ') {
count = 1;
}

//Print letter
printf("%c", hover->ch);

hover = hover->next;
count++;
}

return 0;
}



0 blog comments below




FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.