C语言学生信息系统:根据项目名称录入分数
#include <stdio.h> #include <string.h>
#define MAX_PROJECTS 5 #define MAX_NAME_LENGTH 20
typedef struct { char name[MAX_NAME_LENGTH]; char score; } Student;
int main() { Student students[MAX_PROJECTS];
for (int i = 0; i < MAX_PROJECTS; i++) {
printf("Enter student name: ");
scanf("%s", students[i].name);
printf("Enter score for project %d: ", i+1);
scanf(" %c", &students[i].score);
}
printf("\nStudent Information:\n");
for (int i = 0; i < MAX_PROJECTS; i++) {
printf("Name: %s\tScore: %c\n", students[i].name, students[i].score);
}
return 0;
}
原文地址: https://www.cveoy.top/t/topic/ph6n 著作权归作者所有。请勿转载和采集!