============================================ vis/COMPILE 14:31:47_Thursday_23_August_2001 ============================================ Compiling with gcc -Wall -o projA projA.c... ============================================ vis/Test1.sdiff 14:31:47_Thursday_23_August_2001 ============================================ Differences from the expected output (for Test1): No difference; output is correct. ============================================ vis/Test2.sdiff 14:31:47_Thursday_23_August_2001 ============================================ Differences from the expected output (for Test2): No difference; output is correct. ============================================ vis/Test3.sdiff 14:31:47_Thursday_23_August_2001 ============================================ Differences from the expected output (for Test3): No difference; output is correct. ============================================ vis/Test4.sdiff 14:31:47_Thursday_23_August_2001 ============================================ Differences from the expected output (for Test4): No difference; output is correct. ============================================ vis/Test5.sdiff 14:31:47_Thursday_23_August_2001 ============================================ Differences from the expected output (for Test5): No difference; output is correct. ============================================ vis/Your-Mark 14:31:47_Thursday_23_August_2001 ============================================ Your mark is 5 out of 5. ============================================ src/projA.c 14:31:42_Thursday_23_August_2001 ============================================ /* Project A */ /* Computer Fundamentals B (433-142) */ /* Name: Colin Cheong */ /* Student ID: 134835 */ /* Email: colche@pcpostal.com */ #include #include int main (void) { int c, space = 0, digit = 0, upper = 0, lower = 0, control = 0, punc = 0; double total = 0, spacepercent = 0, upperpercent = 0, lowerpercent = 0, digitpercent = 0, controlpercent = 0, puncpercent = 0; printf("Start Typing:-\n"); while ((c=getchar() ) !=EOF ) { if (isspace(c)) { space++; total++; } else if (iscntrl(c)) { control++; total++; } if (isdigit(c)) { digit++; total++; } if (isupper(c)) { upper++; total++; } if (islower(c)) { lower++; total++; } if (ispunct(c)) { punc++; total++; } } upperpercent = (upper/total)*100; lowerpercent = (lower/total)*100; digitpercent = (digit/total)*100; spacepercent = (space/total)*100; controlpercent = (control/total)*100; puncpercent = (punc/total)*100; if (total == 0) printf("Empty File\n"); else { printf("\nType\t\tFrequency\tPercentage\n"); printf("==========================================\n"); printf("Uppercase\t%d\t\t%.2f\n", upper, upperpercent); printf("Lowercase\t%d\t\t%.2f\n", lower, lowerpercent); printf("Digits\t\t%d\t\t%.2f\n", digit, digitpercent); printf("Space\t\t%d\t\t%.2f\n", space, spacepercent); printf("Control\t\t%d\t\t%.2f\n", control, controlpercent); printf("Punctuation\t%d\t\t%.2f\n", punc, puncpercent); } return 0; }