Hi,
I am new to programming. I am a self taught programmer wannabe. I have no one to consult except books so I think joining this forum would be great.
Could someone tell me why the program below will continue looping after I entered any number with decimal point?
Code:
#include <stdio.h>
int main()
{
float average;
float counter, grade, total;
total =0;
counter = 0;
printf("Enter grade, -1 to end: ");
scanf("%d", &grade);
while(grade != -1)
{
total = total + grade;
counter = counter + 1;
printf("Enter grade, - 1 to end: ");
scanf("%d", &grade);
}
if (counter !=0)
{
average = total/counter;
printf("Class average is %.2f", average);
}
else
printf("No grades were entered");
return 0;
}
Also could you let me know whether the MFC features in Visual C++ 6 could be used with C ?
Is there any IDE software out there that you can use to build GUI forms with C like the drag & drop forms that you see in Visual Basic 6, Visual C++, & JBuilder? If there is none, could you tell me where I can learn (from the internet) writing GUI programs with C?
Thanks for taking the trouble to reply to me.