160809322 Wang Xiangjun-12 jobs

Source: Internet
Author: User

#include <stdio.h>struct student{   char number[10];   Char name[4];   Char gender[20];   Char phone[20];   Char dept[20];   int age;   int score;}; int main () {        return 0;}

  

#include <stdio.h>struct student{    char number[10];    Char name[20];    int age  ;    }; int main () {    student class3[31];    int i=0,j;    FILE *fp=fopen ("G:\\input.txt", "R");    while (!feof (FP))    {        fscanf (FP, "%s%s%d", class3[i].number,class3[i].name,&class3[i].age);        i++;    }    Fclose (FP);    Fp=fopen ("G:\\output.txt", "w");    for (j=0;j<i;j++)        fprintf (FP, "%s    %s    %d\n", class3[j].number,class3[j].name,class3[j].age);    Fclose (FP);        return 0;}

  

#include <stdio.h>struct student{Char number[10];    Char name[20]; int age;};    void Add () {student class3;    int i=0,j;    Char W;    FILE *fp=fopen ("F:\\student.txt", "A +");    printf ("Please enter Name:");    scanf ("%s", Class3.name);p rintf ("Please enter the study number:");    scanf ("%s", Class3.number);    printf ("Please enter Age:");    scanf ("%d", &class3.age);    fprintf (FP, "%s%s%d\n", class3.number,class3.name,class3.age);    printf ("Information added successfully, whether to continue adding student information (y/n)");    scanf ("%s", &w);        Do {printf ("Enter name:");        scanf ("%s", Class3.name);p rintf ("Please enter the study number:");        scanf ("%s", Class3.number);        printf ("Please enter Age:");        scanf ("%d", &class3.age);        fprintf (FP, "%s%s%d\n", class3.number,class3.name,class3.age);        printf ("Information added successfully, whether to continue adding student information (y/n)");    scanf ("%s", &w); }while (w== ' Y ');}    int main () {printf ("Class three student management system \ n");     printf ("Add student information \ n");    int A;    scanf ("%d", &a);    if (a==1) add (); return 0;}

In this question, both Y and N have to continue to add student information, and the judgment in the loop of do while seems useless.

160809322 Wang Xiangjun-12 jobs

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.