Problem X:c language exercises student performance input and output

Source: Internet
Author: User

Problem X:c language exercises student scores input and output time limit:1 Sec Memory limit:128 MB
submit:4722 solved:2284
[Submit] [Status] [Web Board] Description

Write a function print that prints an array of students ' scores, with data for 5 students, each of which includes NUM (student number), name (name), Score[3] (3-course score). Write a function input that is used to enter data for 5 students.

Input

5 student's number, name, 3-course Grade

Output

5 student's number, name, 3-course Grade

Sample Input
1001 Zhangsan 861002 Lisi, 801003 Wangwu, 891004 yanping, 1001005 Xiaoxiao 60 60 60
Sample Output
1001 Zhangsan 861002 Lisi, 801003 Wangwu, 891004 yanping, 1001005 Xiaoxiao 60 60 60
HINT

The main function is given below, and it is not required to include the following main function when committing
/* C code */
int main ()
{
const int n=5;
struct student stu[n];
void input (struct student [],int);
void print (struct student [],int);
Input (stu,n);
Print (stu,n);
return 0;
}


/* C + + code */
int main ()
{
const int n=5;
Student Stu[n];
void input (student [],int);
void print (student [],int);
Input (stu,n);
Print (stu,n);
return 0;
}
#include <stdio.h>struct student{    int Xuehao;    Char name[20];    int score[3];} Stu;void input (struct student stu[],int n) {    int i,j;    for (i=0;i<n;i++)    {        scanf ("%d%s", &stu[i].xuehao,&stu[i].name);        for (j=0;j<3;j++)        {            scanf ("%d", &stu[i].score[j]);        }    }} void print (struct student stu[],int n) {    int i,j;    for (i=0;i<n;i++)    {        printf ("%d%s", stu[i].xuehao,stu[i].name);        for (j=0;j<3;j++)        {            printf ("%d", stu[i].score[j]);        }    printf ("\ n");}    } int main () {    const int n=5;    struct student stu[n];    void input (struct student [],int);    void print (struct student [],int);    Input (stu,n);    Print (stu,n);    return 0;}

  

Problem X:c language exercises student performance input and output

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.