2009/07/28 下午 07:32
昨天学习If语句,本来是很简单的程序,但是不知怎么的,Windows下编译没问题(Dev-C++),但是运行的时候cmd崩溃。在Linux下用gcc编译的时候出错说:“int应为int*”。现将这个问题程序的源码贴出,请各路高手支招。(问题已解决,用红色标记,可恶的百度居然不支持删除线) // Program to calculate the average of a set of grade and count the number of faiing grades #include int main (void) { int numberOfGrades, i, grade; int gradeTotal = 0; int failureCount = 0; float average; printf ("How many grades will you be entering?"); scanf ("%i", numberOfGrades); for ( i = 1; i <= numberOfGrades; i++) { printf ("Enter grade #%i: ", i); scanf ("%i", &grade); gradeTotal = gradeTotal + grade; if (grade < 65) ++failureCount; } |
没有评论:
发表评论