Hey Guys,
----> A little Help would be great
I'm writing this program for my C class on my PB G3. It simply scanf's values into an array which is in an array. It compiles fine, but when I run it the program only lets me enter one value into the array. Then it spits out the entire loop, like its scaning in the printf statement before the scanf statement. It runs fine on my roomates windows machine. Why is this? Any ideas? Am I doing something wrong...or is this a bug in apples implementation of gcc (cc)?
#include <stdio.h>
void main()
{
int input, counter;
char grade_array[50];
printf("*****Grade Stat*****\n\n\n");
printf("Please enter number of grades to be operated on: ");
fflush(stdin);
scanf("%d", &input);
printf("Note: The MAXIMUM number of grades that may be entered is 50\n");
for(counter = 0; counter <= input - 1 ; ++counter)
{
printf("Please Enter a Grade: ");
fflush(stdin);
scanf("%c", &grade_array[counter]);
fflush(stdin);
}
}
my source code....
Any help would be great! I don't understand this
----> A little Help would be great
I'm writing this program for my C class on my PB G3. It simply scanf's values into an array which is in an array. It compiles fine, but when I run it the program only lets me enter one value into the array. Then it spits out the entire loop, like its scaning in the printf statement before the scanf statement. It runs fine on my roomates windows machine. Why is this? Any ideas? Am I doing something wrong...or is this a bug in apples implementation of gcc (cc)?
#include <stdio.h>
void main()
{
int input, counter;
char grade_array[50];
printf("*****Grade Stat*****\n\n\n");
printf("Please enter number of grades to be operated on: ");
fflush(stdin);
scanf("%d", &input);
printf("Note: The MAXIMUM number of grades that may be entered is 50\n");
for(counter = 0; counter <= input - 1 ; ++counter)
{
printf("Please Enter a Grade: ");
fflush(stdin);
scanf("%c", &grade_array[counter]);
fflush(stdin);
}
}
my source code....
Any help would be great! I don't understand this