これは私がこのサイトで見つけた質問ですが、回答は私が考えている問題とは直接関係がありませんでした. まだまだ素人なので恥ずかしいです。入力したい GPA の数をユーザーに尋ねています。次に、各インデックスの入力を求めています。問題は、各インデックスが 0 を返すことです。そのため、変数の型またはインデックスをインクリメントする方法を台無しにしていると確信しています。これは宿題の問題であり、私は完全なプレゼントよりもガイダンスを求めています.
#include<stdio.h>
main()
{
char Rspns;
int i, toCount, Total;
float GPA[toCount];
printf("\n\tYou can average up to 30 GPAs.");
printf("\n\tPlease choose how many GPAs you would like to average:");
scanf(" %d" , &toCount);
//assign how many indexes array should have
for(i = 0; i<toCount; i++)
GPA[i] = i++;
do
{
system("cls");
printf("\n\nEnter a GPA:");
scanf(" %f" , &GPA);
printf(" %f" , GPA[i]);
Total += GPA[i];
getch();
system("cls");
printf("\n\n\tWould you like to average the current amount of GPA's?");
printf("\n\nY/N: ");
scanf(" %c" , &Rspns);
if(Rspns == 'y' || Rspns == 'Y')
{
Total = Total / toCount;
printf("The average of those GPAs is %.1f" , Total);
getch();
}// end response
}while(i<=toCount);//end forCount
Total = Total / toCount;
}