Statistics Student Information

Source: Internet
Author: User
Description
Using dynamic linked list to record student information entered from standard input (school number, name, sex, age, score, address) in

which, the length of the school number is not more than 20, the name length is not more than 40, the gender length is 1, address length not exceeding 40
input
includes several lines, each of which is a student's information, such as:
00630018 zhouyan m 10.0 28#460
input ended with "end"
Output
Output the input in reverse
order, one record per line,
the format of the sex-age-score address according to the school number name
Sample Input
00630018 Zhouyan m 28#4600
0063001 Zhouyn f 28#460000
0063008 Zhoyan F 1000 28#460000
00630 Zhouan m 10000 28#4600000
00613018 zhuyan m 28#4600 00160018
f Zouyan
01030018 Houyan m 28#4600
0630018 Zuyan m 28#4600 10630018-Zouan
m 28#46000 end

Sample Output
10630018 Zouan m 28#46000
0630018 zuyan m 28#4600
01030018 houyan m 28#4600 00160018 Zouyan
F 28#4600
00613018 Zhuyan m 28#4600 0063018 Zhouan m 10000 28#4600000 0063008 Zhoyan
F 20 10 28#460000
0063001 Zhouyn f 28#460000
00630018 Zhouyan m 20 10 28#4600

memcpy (Studentid,sid,strlen (SID) +1);
Look here, Orz.

#include <bits/stdc++.h> using namespace std;
Char buf[50];
const char end[]= "End";
        struct linktable{public:linktable* Front;
        Char studentid[50];
        Char studentname[50];
        Char sexuality[2];
        int studentage;
        int Score;
        Char address[50];
            void Read (char* sid) {memcpy (Studentid,sid,strlen (SID) +1);
        scanf ("%s%s%d%d%s", studentname,sexuality,&studentage,&score,address); void print () {printf ('%s%s%s%d%d%s\n '), This->studentid,this->studentname,this->sexualit
        y,this->studentage,this->score,this->address);
        } linktable () {Front = NULL;
}
};
linktable* tail = NULL;
    void Insert () {linktable* p = new LinkTable;
    P->front = Tail;tail = P;   
P->read (BUF);
    } void Print () {linktable* p = tail;             
for (;p!=null;p=p->front) p->print (); int main () {while (scanf ("%s"), BUf)) {if (strcmp (buf,end) ==0) break;
    Insert ();    
    } Print ();
return 0; }

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.