Я очень новичок в программировании, поэтому, пожалуйста, простите мое невежество. Я уже пытался найти, как использовать scanf, и попробовал различные способы его использования, но я все равно получаю сообщение об ошибке после того, как попытаюсь ввести первый ввод. Когда я пытался запустить программу с заданным номером, она работает (вплоть до моей второй проблемы, к которой я обращусь), поэтому я знаю ее первый scanf. Я ценю любую помощь. Вот что я пытаюсь работать на:Ошибка для scanf и нескольких входов
//C code
#include <stdio.h>
using namespace std;
int main() {
//Declare variables
char StudentName[100];
float Avg;
int Sum, Students, TotalStudents, TotalClasses, Classes, A, B, C, D, F;
A=4;
B=3;
C=2;
D=1;
F=0;
//This is where the problem begins.
//I want to allow the user to input the number of students
//being graded. "Enter the number of students being graded"
//comes up fine.
printf ("Enter the number of students being graded.");
scanf ("%i", TotalStudents);
//First loop
for (Students = 0; Students<1; Students++){
Avg =0.0;
printf ("Enter Student Name \n");
scanf ("%s", StudentName);
printf ("Enter Number of Classes \n");
scanf ("%f", TotalClasses);
for (Classes = 0; Classes < TotalClasses; Classes++){
printf ("Enter Letter Grade for Class \n");
//The second problem starts here. I am trying to find a way to
//allow the user to input the letter grade and add all the grades
//together. After that I want it to find the average for that
//student before moving on to the next student.
//I know my code is completely wrong but I don't know how to correct
//it based off of the examples I have seen
scanf ("%i", A || B || C|| D || F);
Sum = Sum + A || B || C|| D || F;
}
Avg = Sum/TotalClasses;
printf ("%s's average is %f \n", StudentName, Avg);
}
return 0;
}