ADD file via upload

main
pecp45i32 4 days ago
parent caedd1e493
commit b0e78d6332

@ -0,0 +1,85 @@
#include <stdio.h>
#define COL 4
int studentMember = 0;
void inputStudentInformation(double store[][COL])
{
double* p;
int i = 0, j = 0;
while (1) {
p = &store[i][j];
double temp;
scanf("%lf", &temp);
*p = temp;
j++;
if (j == COL) {
printf("One student's information has been, input 0 or 1 to quit or continue.\n");
int ch;
scanf("%d", &ch);
if (ch == 0) { break; }
else if (ch == 1)
{
j = 0;
i++;
studentMember++;
}
else {
printf("WRONG INPUT,aoto quit\n");
break;
}
}
}
}
double sumScore(double store[][COL], int n) {
double sum = 0;
for (int i = 1; i < COL; i++) {
sum += store[n][i];
}
return sum;
}
void printStudentOriginalScore(double store[][COL])
{
for (int i = 0; i <= studentMember; i++) {
printf("%5d %.1f %.1f %.1f %.1f\n", (int)store[i][0], store[i][1], store[i][2], store[i][3], sumScore(store, i));
}
}
void manage()
{
printf(" 1.Input\n");
printf(" 2.Output\n");
printf(" 3.Order\n");
printf(" 4.Quit\n");
char keywords;
keywords = getchar();
switch (keywords) {
case 'i':
printf("You are trying to Input info\n");
break;
case 'o':
printf("You are trying to Output info\n");
break;
case 'm':
printf("You are trying to Make things ordered\n");
break;
case 'q':
printf("You are about to Quit\n");
break;
default:
printf("Wrong input\n");
break;
}
}
int main()
{
double* p, storeInformation[100][COL];
inputStudentInformation(storeInformation);
printStudentOriginalScore(storeInformation);
//manage();
return 0;
}
Loading…
Cancel
Save