I have to write this pig latin program for my class and for some reason it's not working. I'm almost done, just debugging now. If anyone could tell me what's wrong...that'd be appreciated...thanx.
If anyone has any questions...e-mail me @ spurn@dslextreme.comCode:#include<fstream.h> void main (void) { ifstream inputfile; ofstream outputfile; const int limit = 99; int i, vowel_place; char sentence[limit]; char char1; inputfile.open("Input.txt"); outputfile.open("Output.txt"); i = 0; inputfile.getline(sentence, limit); while (!inputfile.eof()) { if (!inputfile) break; inputfile.getline(sentence, limit); while (sentence[i] == '\0') { if (sentence[i] != '\0' && (sentence[i] == ' ' || sentence[i] == ',' || sentence[i] == '.' || sentence[i] == '?' || sentence[i] == '!' || sentence[i] == '-')) { outputfile << sentence[i]; } else { if (sentence[i] != '\0' && (sentence[i] == 'a' || sentence[i] == 'e' || sentence[i] == 'i' || sentence[i] == 'o' || sentence[i] == 'u' || sentence[i] == 'A' || sentence[i] == 'E' || sentence[i] == 'I' || sentence[i] == 'O' || sentence[i] == 'U')) { while (sentence[i] != '\0' && (sentence[i] == ' ' || sentence[i] == ',' || sentence[i] == '.' || sentence[i] == '?' || sentence[i] == '!' || sentence[i] == '-')) { outputfile << sentence[i]; i++; } outputfile << "ay" << sentence[i]; } else { if (sentence[i] != '\0') { char1 = sentence[i]; i++; while (sentence[i] != '\0' && (sentence[i] == ' ' || sentence[i] == ',' || sentence[i] == '.' || sentence[i] == '?' || sentence[i] == '!' || sentence[i] == '-')) { outputfile << sentence[i]; i++; } outputfile << char1 << "ay" << sentence[i]; } } } } } cout << outputfile; inputfile.close(); outputfile.close(); }



LinkBack URL
About LinkBacks


