日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

学生档案c语言编程,学生档案管理问题

發布時間:2023/11/30 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 学生档案c语言编程,学生档案管理问题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

/* 一個修改版本 */

#include

struct student

{

int??num;

char name[10];

char sex;

char address[20];

};

struct student stu[3] = {

{000, "li lin", 'm', "103 beijing road"},

{001, "zhang fun", 'm', "130 shanghai road"},

{002, "wang min", 'f', "1010 zhongshan road"}

};

void query(void);

void modify(void);

int main(void)

{

char ch;

int i;

printf("num??? name???sex??? address\n");

for (i = 0; i < 3; i++)

printf("%5d%10s%3c%20s\n", stu[i].num, stu[i].name,

stu[i].sex, stu[i].address);

putchar('\n');

printf("do you want to query? [Y/N]\n");

scanf("%c", &ch);

putchar('\n');

if(ch != '\n')

while(getchar() != '\n')

continue;

if (ch == 'Y' || ch == 'y')

query();

printf("do you want to modify? [Y/N]\n");

scanf("%c", &ch);

putchar('\n');

if(ch != '\n')

while(getchar() != '\n')

continue;

if (ch == 'Y' || ch == 'y')

modify();

printf("Bye!\n");

getchar();

return 0;

}

void query()

{

int i, number, k;

printf("please enter numbers: ");

while(scanf("%d", &number) != 1)

{

printf("please enter numbers[integer]: ");

while(getchar() != '\n')

continue;

}

while(getchar() != '\n')

continue;

printf("num??? name??????????????? sex??? address\n");

for (i = k = 0; i < 3; i++)

{

if (number == stu[i].num)

{

printf("%-3d??? %-20s %c??? %20s\n", stu[i].num, stu[i].name,

stu[i].sex, stu[i].address);

k = 1;

}

}

if(k == 0)

printf("Not!\n");

putchar('\n');

}

void modify()

{

int modinum, k, i;

printf("please input theseat which you will modify:");

while(scanf("%d", &modinum) != 1)

{

printf("please input theseat which you will modify[integer]:");

while(getchar() != '\n')

continue;

}

while(getchar() != '\n')

continue;

for (i = k = 0; i < 3; i++ )

{

if (modinum == stu[i].num)

{

printf("Please enter num: ");

while(scanf("%d", &stu[i].num) != 1)

{

printf("Please enter num[integer]: ");

while(getchar() != '\n')

continue;

}

while(getchar() != '\n')

continue;

printf("Please enter name: ");

while(scanf("%s", stu[i].name) == 0)

{

while(getchar() != '\n')

continue;

printf("Please enter name: ");

}

while(getchar() != '\n')

continue;

do

{

printf("Please enter sex[m/f]: ");

scanf("%c",??&stu[i].sex);

while(getchar() != '\n')

continue;

}while(stu[i].sex != 'm' && stu[i].sex != 'f');

printf("Please enter address: ");

while(scanf("%s",??stu[i].address) == 0)

{

printf("Please enter address: ");

while(getchar() != '\n')

continue;

}

while(getchar() != '\n')

continue;

k = 1;

}

}

if(k == 0)

printf("Not!\n");

putchar('\n');

}

總結

以上是生活随笔為你收集整理的学生档案c语言编程,学生档案管理问题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。