第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

編程執(zhí)行的時候有問題

編程執(zhí)行的時候有問題

C
慕雪6341044 2017-06-11 11:24:17
查看完整描述

1 回答

?
望遠

TA貢獻1017條經(jīng)驗 獲得超1032個贊

把代碼貼出來看看,可能是在輸入數(shù)據(jù)的時候沒有&取地址符號。

查看完整回答
1 反對 回復(fù) 2017-06-11
  • 慕雪6341044
    慕雪6341044
    #include<stdio.h> #include<string.h> #include<stdlib.h> int m, n; struct student { int num; char name[10]; char sex[5]; char class[10]; char major[10]; int dorm; }stu[1]; void input() { int i = 0; char t = 'y'; FILE *fp; fp = fopen("inform.txt", "w"); if (fp = NULL) { printf("error!\n"); exit(0); while (1) { printf("please enter student data:"); scanf("%d\n%d\n%s\n%c\n%s\n%s\n", &stu[i].num, &stu[i].dorm, &stu[i].name, &stu[i].sex, &stu[i].class,&stu[i].major); printf("是否繼續(xù)輸入(y/n)?: "); scanf("%c", &t); if (t == 'y' || t == 'Y') { i++; } } } fclose(fp); } void add() { int i = 0; char t = 'y'; FILE *fp; fp = fopen("inform.txt", "w"); if (fp = NULL) { printf("error!\n"); exit(0); while (1) { printf("please enter student data:"); scanf("%d\n%d\n%s\n%c\n%s\n%s\n", &stu[i].num, &stu[i].dorm, &stu[i].name, &stu[i].sex, &stu[i].class,&stu[i].major); printf("是否繼續(xù)添加(y/n)?: "); scanf("%c", &t); if (t == 'y' || t == 'Y') { i++; } } } fclose(fp); } void del() { int i, num; char t = 'y'; FILE *fp, *fp1; printf("please enter del num:"); scanf("%d", &num); printf("%d\n%d\n%s\n%c\n%s\n%s\n", &stu[i]
  • 慕雪6341044
    慕雪6341044
    void del() { int i, num; char t = 'y'; FILE *fp, *fp1; printf("please enter del num:"); scanf("%d", &num); printf("%d\n%d\n%s\n%c\n%s\n%s\n", &stu[i].num, &stu[i].dorm, &stu[i].name, &stu[i].sex, &stu[i].class,&stu[i].major); for (n = i; n<m; n++) { stu[n] = stu[n + 1]; } printf("OK"); printf("是否繼續(xù)刪除(y/n)?: "); scanf("%c", &t); if (t == 'y' || t == 'Y') { i++; } fclose(fp); } void change() { FILE *fp; int num, i = 0; char t = 'y'; fp = fopen("inform.txt", "rb+"); while (t == 'y' || t == 'Y') { while (1) { printf("請輸入修改的學(xué)號:"); scanf("%d", &num); if (num > 0) break; } while (!feof(fp)) { i = 0; fread(&stu[i], (long)sizeof(struct student), 1, fp); if (stu[i].num == num&&i == 0) { printf("你要修改的學(xué)生的信息:\n"); printf("%d\n%d\n%s\n%c\n%s\n%s\n", &stu[i].num, &stu[i].dorm, &stu[i].name, &stu[i].sex, &stu[i].class,&stu[i].major); i++; printf("你要修改的學(xué)生的信息:\n"); printf("please enter student data:"); scanf("%d\n%d\n%s\n%c\n%s\n%s\n", &stu[i].num, &stu[i].dorm, &stu[i].name, &stu[i].sex, &stu[i].class,&stu[i].major); fseek(fp, -(long)sizeof(struct student), 1); fwrite(&stu[i], (long)sizeof(struct student),
  • 慕雪6341044
    慕雪6341044
    &stu[i].name, &stu[i].sex, &stu[i].class,&stu[i].major); fseek(fp, -(long)sizeof(struct student), 1); fwrite(&stu[i], (long)sizeof(struct student), 1, fp); fseek(fp, (long)sizeof(struct student), 1); } } printf("是否繼續(xù)修改(y/n):"); scanf("%c", &t); if (t == 'y' || t == 'Y') { rewind(fp); i = 0; } } fclose(fp); } void search() { FILE *fp; int num,i=0; char t = 'y'; fp = fopen("inform.dat", "rb"); while (t == 'y' || t == 'Y') { while (1) { printf("請輸入查詢的學(xué)號:"); scanf("%d", &num); if (num > 0) break; } while (!feof(fp)) { fread(&stu[i], (long)sizeof(struct student), 1, fp); if (stu[i].num == num) { printf("%d\n%d\n%s\n%c\n%s\n%s\n", &stu[i].num, &stu[i].dorm, &stu[i].name, &stu[i].sex, &stu[i].class,&stu[i].major); break; } } printf("是否要繼續(xù)查找(y/n):"); scanf("%c", &t); if (t == 'y' || t == 'Y') { rewind(fp); } fclose(fp); } } void off() { exit(0); } void main() { char ch; do { printf(" 歡迎進入高校學(xué)生宿舍學(xué)生信息管理系統(tǒng) \n"); printf(" \n"); printf(" \n"); printf("
點擊展開后面4
  • 1 回答
  • 0 關(guān)注
  • 1019 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號