Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help!!! What am I doing wrong? Here is the programming challenge: Write a

ID: 3658891 • Letter: P

Question

Please help!!! What am I doing wrong? Here is the programming challenge: Write a program that reads the file's contents and determines the following: 1. The number of uppercase letters in the file. 2. The number of lowercare letters in the file. 3. The number of digits in the file. Here is what I have: #include #include #include #include using namespace std; int main () { //Variables to be used char ch; int countUpper = 0; int countLower = 0; int countDigits = 0; //File stream object ifstream inFile; //Open file inFile.open ("text.txt"); if(inFile.fail()) { cout << "Text file did not open. Try again. "; system ("exit"); } //Get and read characters from the file inFile.get(ch); //Count the uppercase letters in the file if (isupper(ch)!= '') countUpper = countUpper + 1; //Count the lowercase letters in the file if(islower(ch) != '') countLower = countLower + 1; //Count the digits in the file if(isdigit(ch)!= '') countDigits = countDigits + 1; cout << "The number of uppercase letters in the file is: " << countUpper << endl; cout << "The number of lowercase letters in the file is: " << countLower << endl; cout << "The number of digits in the file is: " << countDigits << endl; inFile.close(); system ("pause"); return 0;

Explanation / Answer

your question is without any indentations so its a bit difficult to follow. somethings that i want to point is that. 1) at the end of the program you have not closed "int main()" function since "}" is missing at the end. 2) use your comment line starting with "//" properly, as in the question it is not clear that it is used separately or not. if there is some other problem then let me know.....now rate me :)