1 (Title) : DSA Practice Report
1 (Title) : DSA Practice Report
StudentID 16511510010
Practice No. 1
Practice Title
Date
Place
Mark
Checked by Wingo WU
1 [Title]
1.1 Procedure
Explain your steps to solve the problem. It maybe very simple or maybe very detail
Copy your full source code, do not miss anything. don’t do any change.Your program
should begin with the following information
#include "stdafx.h"
#include <stdio.h>
typedef struct student
{
char name[50];
int ID;
int chinese;
int maths;
int physics;
int ranck;
int total;
} STUD;
printf("%-10d\t%-10s\t %d \t %d \t %d\t%d\t
%d\n",std[i].ID,std[i].name,std[i].chinese,std[i].maths,std[i].physics,std[i].t
otal,std[i].ranck);
}
}
void Input_stud(STUD std[20],int n)
{
int i;
for(i=0;i<n;i++)
for(i=0;i<n;i++) {
printf("ID:");
scanf("%d",&std[i].ID);
printf("Name:");
scanf("%s",std[i].name);
printf("Chinese:");
scanf("%d",&std[i].chinese);
printf("Maths:");
scanf("%d",&std[i].maths);
printf("Physics:");
scanf("%d",&std[i].physics);
}
void Total_stud(STUD std[20],int n)
{
int i;
for (i=0;i<n;i++)
{
std[i].total= std[i].chinese+std[i].maths+std[i].physics;
}
for(j=0;j<n;j++)
{
k = 1;
for(i=0;i<n;i++){
if (std[j].total < std[i].total)
k++;
}
std[j].ranck = k;
int main()
{
STUD std[20];
int i,n;
printf("******************************************************************\n");
printf("******************************************************************\n");
scanf("%d",&n);
Input_stud(std,n);
Total_stud(std,n);
Rank_stud(std,n);
printf("*********************************************************************\n
");
printf("StudentID\tName\t\tChinese\tMaths\tPhysics\tTotal\tRank\n");
Output_stud(std,n);
getchar();
getchar();
return 0;
}
/*
*/
1.4 Summary