The C language master comes in and writes a small program

Updated on technology 2024-03-07
5 answers
  1. Anonymous users2024-02-06

    Define an array of scores to record scores, record rankings and score bins.

    record+0) records the first place score, *(record+1) records the number of first place, *(record+2) records the second place score, *(record+3) records the number of second place, *(record+4) records the third place score, *(record+5) records the number of third place, *(record+6) records the number of good people, (record+7) records the number of good people, (record+8) records the number of people in the record, (record+9) to record the number of people who failed.

    #include

    #include

    #include

    void sort_score(int *score,int *record,int total),i,j;first relevant variables;

    i=j=0;

    record=record_;

    printf("Please enter the number of students (>=3):");Enter the number of people n;

    scanf("%d",&total);

    score=(int *)malloc(sizeof(int)*total);Open up a total int space;

    printf("Enter the 1st - D Person Score:",(5for( ;jscanf("%d",score+j);

    if((j+1)%5==0 &&j!=0)

    if(j+2 != total)

    printf("Enter %2d - %2d person score:",j+2,(j+6elseprintf("Enter the grade of the %d person:",total);

    sort_score(score,record,total);call subfunctions;

    printf("Best Grades:");Output the best score, score and number of people;

    3;i++)

    printf("%d: %d:%d",i+1,*(record+2*i),*record+2*i+1));

    printf("Statistics on the number of people in each block:");

    printf("Superior %d people",*(record+6));output excellent number of people;

    printf("Good %d people",*(record+7));output good number of people;

    printf("Medium %d people",*(record+8));Number of people in output;

    printf("Failing %d person",*(record+9));output the number of failed students;

  2. Anonymous users2024-02-05

    This seems to be an example in the book ==! Tan version c language.

  3. Anonymous users2024-02-04

    #include

    int main()

    int n,i=1,a[3]=,cj;

    aUsed to store the top three results.

    int aa=0,b=0,c=0;Used to store the number of top three finishers.

    float k;

    int y=0,l=0,z=0,bj=0;

    printf("Please enter the number of students in the middle school");

    scanf("%d",&n);

    for(i;i<=n;i++)

    printf("Please enter the grade for the %d student:",i);

    scanf("%d",&cj);

    Each grade entered is arranged.

    This chain of judgments is used to find out the top three and the number of people they correspond to.

    Only six cases are considered: cj>a[0]; cj=a[0];a[0]>cj>a[1];cj=a[1];a[1]>cj>a[2];cj=a[2]。

    if(cj>a[0]) If the number is larger than the original maximum, replace a[0] and move the rest backward. The following is followed by an analogy, with the difference being that the second largest number and the third largest number are compared.

    a[2]=a[1];

    a[1]=a[0];

    a[0]=cj;

    c=b=aa=1;

    If the original a[0] is not the maximum, the previous count is cleared to zero.

    else if(cj==a[0])aa++;

    else if(cj>a[1])

    a[2]=a[1];

    a[1]=cj;

    c=b;b=1;

    else if(cj==a[1])b++;

    else if(cj>a[2])

    a[2]=cj;

    c=1;else if(cj==a[2])c++;

    if(cj>=90)y++;

    else if(cj>=75)l++;

    else if(cj>=60)z++;

    else bj++;

    printf("The first place is %d, and the number of people is %d",a[0],aa);

    printf("The second place has a score of %d, and the number of people has %d",a[1],b);

    printf("The third place is %d, and the number of people is %d",a[2],c);

    k=n;printf("The percentage of excellent is %2f%%",100*y/k);

    printf("The percentage of good is %2f%%",100*l/k);

    printf("The percentage is %2f%%",100*z/k);

    printf("The percentage of failures is %2f%%",100*bj/k);

    return 0;

  4. Anonymous users2024-02-03

    It depends on how well you know C, hehe, what does it seem interesting to you? Mini-games can have snakes, backgammon, blocks, ......The small management system has student information management, library management ......All kinds of management can be trialed! Of course, C can also program the operating system, drivers ......And much more!

    Study hard, I'm sure you'll love it!

  5. Anonymous users2024-02-02

    What makes it interesting? Game or management system?

Related questions
10 answers2024-03-07

It's a shame to ask your question, one is the development environment, the other is the language, what's the difference, you're laughing to death.

11 answers2024-03-07

I feel very simple...

#include >>>More

16 answers2024-03-07

Definition of a for loop.

for(the initial value of the variable; termination of operating conditions; The initial value of the first cycle i is 0, and it runs until i=3 stops i=2, and the condition is still satisfied, and the loop body is still executed, and the step size is 1+1 each time >>>More

9 answers2024-03-07

Hey! This is a very simple function to write, Your Excellency is estimated to have just learned data structures, now learn sorting, lookup, it's easy to give me a reward of two hundred points, I'll help you write it right away. >>>More

11 answers2024-03-07

Gu Yun's forty people are not confused, and now they are on a higher level. >>>More