1. 關於c語言編寫一個學生信息管理系統的問題
那就用結構體 struct student{
int no;
char *name;
int age;
char *class;
char* phone;
char *address;
};
再定義一個結構體數組student students[n] ;n自己指定,最好用動態數組創建。像增刪改查這樣的操作你就對數組操作就行了
2. C語言鏈表版的學生信息管理系統的問題,為什麼我的文件錄入函數不能執行
請問一下,裡面的pnew變數是表示的一個新節點吧?既然這樣你里邊的pnew變數是很亂的,根本構不成鏈,先定一個頭節點,頭節點不存儲數據,後邊依次鏈接各個節點,同時用malloc()函數申請存儲空間。另外可以考慮把while()結構換成do - while結構
有問題發郵件 :[email protected]
[email protected]
3. c語言 學生管理系統 出現問題
這個是我最近編寫的,跟你分享一下吧!!C++編的!!
#include<iostream>
#include<fstream>
#include<iomanip>
#include<string>
using namespace std;
struct student
{
string no;
char name[30];
float math,computer,english,policy ;
float sumScore;
}stu[100]={"0","0",0,0,0,0}; //定義了一個結構體類型的 學生學籍信息 數據類型
typedef struct collecemessage
{ string title;
float standardScare;
char collegename[50];
}; //定義了具有研究生招收權的學院信息 數據類型
collecemessage colmes[100]={"0",0,"0"}; //學院信息 全局結構體數組
collecemessage collectStuMes[100]={"0",0,"0"}; //學院信息採集後,滿足條件的學生學院信息 全局級變數
int collectStucount=0; //滿足條件學生個數統計變數 全局級變數
int FLAG=0; //用來驗證 函數 void directMessage(int count1,int count2) 是否執行
string CollegeMessage="0"; //考研學院信息變數
string message="0";
void function(); // 學生考研成績信息查詢子系統 所有函數聲明
void SumScore(int count);
void exiteNUMMessage(int count);
void MessageSort(int count);
void MessageSort(int count,string subject);
string Sortsubject();
int setup();
void displayMessage(int count);
void edit(int count);
int deleteStudent(int count1);
void xueyuanxinxijianjie();
int collegemessagesetup(); //大學生考研信息指南子系統 所有函數聲明
void collegemessageedit(int count);
void displaycollegeMessage(int count);
void directMessage(int count1,int count2);
float StudentsumScore(int count);
void studentMessageDisplay(int count1,int count2);
string collegename();
void collectSchoolmes(int i);
int main()
{static int count1,count2;
function(); //顯示程序的歡迎界面
system("pause");
system("cls") ;
loop2 :
system("cls");
for(int i=0;i<5;i++) cout<<endl;
cout<<"\t\t★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★\n\n\n";
cout<<"\t\t★ ★ 大學生考研模擬系統 ★ ★\n\n\n";
cout<<"\t\t★ ★ 1.學生考研成績信息查詢 ★ ★\n\n\n";
cout<<"\t\t★ ★ 2.大學生考研信息指南 ★ ★\n\n\n";
cout<<"\t\t★ ★ 0.退出系統 ★ ★\n\n\n";
cout<<"\t\t★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★\n\n\n";
int choice;
cout<<"============== 開始體驗考研信息模擬系統給你帶來的樂趣吧!!!!!==============="<<endl<<endl;
cout<<"你想進入的系統 ";cin>>choice;
switch(choice)
{ case 1:
{loop:
cout<<endl<<endl;
cout<<"\t\t★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★\n\n";
cout<<"\t\t★ 學生信息處理模塊系統 ★\n\n";
cout<<"\t\t★ 1 - 錄入學生信息 ★\n\n";
cout<<"\t\t★ 2 - 查找學生信息 ★\n\n";
cout<<"\t\t★ 3 - 顯示學生信息 ★\n\n";
cout<<"\t\t★ 4 - 學生信息排序 ★\n\n";
cout<<"\t\t★ 5 - 修改學生信息 ★\n\n";
cout<<"\t\t★ 6 - 刪除學生信息 ★\n\n";
cout<<"\t\t★ 0 - 退出 ★\n\n";
cout<<"\t\t★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★\n\n";
static int menu,tem=0;
string num;
int flag=0; //程序中設置了一個旗幟標記
cout<<endl<<">>>>>>>選擇你的服務: ";cin>>menu;
system("cls");
switch (menu)
{
case 1:
{
count1=setup();
system("cls");
goto loop;
break;
}
case 2:
{ exiteNUMMessage(count1);
SumScore(count1);
cout<<endl<<"-----------------------請輸入您想查詢的學號-------------------------"<<endl;
cout<<"輸入你要進行查找的學生學號: ";cin>>num;
cout<<endl<<endl; //這行功能是進行換行
for(int i=0;i<count1;i++)
if(stu[i].no==num && num!="0")
{tem=i;
cout<<" 學號 姓 名 計算機成績 數學成績 英語成績 政治成績"<<endl<<endl;
cout<<stu[tem].no<<setw(10)<<stu[tem].name<<setw(10)<<stu[tem].computer<<setw(15)\
<<stu[tem].math<<setw(15)<<stu[tem].english<<setw(13)<<stu[tem].policy<<setw(10)<<endl;
cout<<"\n\n**********"<<stu[tem].name<<"2010年考研總分是: "<<stu[tem].sumScore<<endl<<endl;
flag=1;
}
if(flag==0)
cout<<"對不起,該學號不存在!\n";
system("pause");
system("cls");
goto loop;
break;
}
case 3:
{ displayMessage(count1);
system("pause"); // 這一句的目的是讓屏幕暫停一下,用戶可以看到信息
system("cls"); // 清除屏幕信息
goto loop;
break;
}
case 4:
{ displayMessage(count1);
MessageSort(count1,Sortsubject());
displayMessage(count1);
system("pause"); // 這一句的目的是讓屏幕暫停一下,用戶可以看到信息
system("cls"); // 清除屏幕信息
goto loop;
break;
}
case 5:
{ displayMessage(count1);
edit(count1);
system("cls");
goto loop;
break;
}
case 6:
{ count1=deleteStudent(count1);
system("cls");
goto loop;
break;
}
case 0:
{ system("cls");
for(int i=0;i<5;i++)
cout<<endl;
cout<<"\t\t★ ★ ★ ★ ★ 謝 謝 使 用 ★ ★ ★ ★ ★"<<endl<<endl<<endl;
cout<<"\t\t★ 你好,感謝您進入學生信息處理模塊系統 ★"<<endl<<endl<<endl;
cout<<"\t\t★ 歡 迎 下 次 再 來 ★"<<endl<<endl<<endl;
cout<<"\t\t★ ★ ★ 歡迎返回大學生考研模擬系統主界面 ★ ★ ★"<<endl<<endl<<endl;
system("pause");
goto loop2;
break;
}
default:
{ for(int i=0;i<5;i++)
cout<<endl;
cout<<"\t\t\t★ ★ ★ ★ ★ 錯 誤 請 求 ★ ★ ★ ★ ★"<<endl<<endl<<endl;
cout<<"\t\t\t★ ★ ★ ★ ★ 重 新 選 擇 操 作 ★ ★ ★ ★ ★"<<endl<<endl<<endl;
cout<<"\t\t\t★ ★ ★ ★ ★ 謝 謝 使 用 ★ ★ ★ ★ ★"<<endl<<endl<<endl;
cout<<"\t\t\t★ 您好!!忠告您一句,以後辦事情要認真寫些 !★"<<endl<<endl<<endl;
cout<<"\t\t\t★ ★ 歡迎返回大學生考研信息主界面 ★ ★"<<endl<<endl<<endl;
system("pause");
system("cls");
goto loop;
break;
}
}
break;
}
case 2:
loop3: {system("cls");
for(int i=0;i<5;i++) cout<<endl;
cout<<"\t\t★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★\n\n\n";
cout<<"\t\t★ 大學生考研信息指南 ★\n\n\n";
cout<<"\t\t★ 1 - 報考院校詳細信息 ★\n\n\n";
cout<<"\t\t★ 2 - 學生考研結果信息 ★\n\n\n";
cout<<"\t\t★ 0 - 退出考研查詢系統 ★\n\n\n";
cout<<"\t\t★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★\n\n\n";
int menu;
cout<<endl<<">>>>>>>選擇你的服務: ";cin>>menu;
switch(menu)
{case 1:
{ loop1: system("cls");system("cls");
for(int i=0;i<3;i++) cout<<endl;
cout<<"\t\t★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★\n\n";
cout<<"\t\t★ 大學生考研學院信息模塊 ★\n\n";
cout<<"\t\t★ 1 - 學院招生信息初始化 ★\n\n";
cout<<"\t\t★ 2 - 學院基本信息修改 ★\n\n";
cout<<"\t\t★ 3 - 學院基本信息顯示 ★\n\n";
cout<<"\t\t★ 4 - 學院基本信息向導指南 ★\n\n";
cout<<"\t\t★ 0 - 退出 ★\n\n";
cout<<"\t\t★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★\n\n";
cout<<">>>>>>>選擇你的服務: ";cin>>menu;
{ switch(menu)
{case 1:
{system("cls");
count2=collegemessagesetup();
goto loop1;
break;
}
case 2:
{system("cls");
collegemessageedit(count2);
goto loop1;
break;
}
case 3:
{ system("cls"); // 清除屏幕信息
displaycollegeMessage(count2);
system("pause"); // 這一句的目的是讓屏幕暫停一下,用戶可以看到信息
goto loop1;
break;
}
case 4:
{ directMessage(count1,count2);
system("pause"); // 這一句的目的是讓屏幕暫停一下,用戶可以看到信息
system("cls"); // 清除屏幕信息
goto loop1;
break;
}
case 0:
{ system("cls");
for(int i=0;i<5;i++)
cout<<endl;
cout<<"\t\t★ ★ ★ ★ ★ 謝 謝 使 用 ★ ★ ★ ★ ★"<<endl<<endl<<endl;
cout<<"\t\t★ 您好,大學生考研學院信息模塊 ★"<<endl<<endl<<endl;
cout<<"\t\t★ 歡 迎 下 次 再 來 ★"<<endl<<endl<<endl;
cout<<"\t\t★ ★ ★ 歡迎返回大學生考研信息指南主界面 ★ ★ ★"<<endl<<endl<<endl;
system("pause");
goto loop3;
break;
}
default:
{ for(int i=0;i<5;i++)
cout<<endl;
cout<<"\t\t\t★ ★ ★ ★ ★ 錯 誤 請 求 ★ ★ ★ ★ ★"<<endl<<endl<<endl;
cout<<"\t\t\t★ ★ ★ ★ ★ 重 新 選 擇 操 作 ★ ★ ★ ★ ★"<<endl<<endl<<endl;
cout<<"\t\t\t★ ★ ★ ★ ★ 謝 謝 使 用 ★ ★ ★ ★ ★"<<endl<<endl<<endl;
cout<<"\t\t\t★ 您好!!忠告您一句,以後辦事情要認真寫些 !★"<<endl<<endl<<endl;
cout<<"\t\t\t★ ★ 歡迎返回大學生考研信息主界面 ★ ★"<<endl<<endl<<endl;
system("pause");
system("cls");
goto loop1;
break;
}
system("pause");
break;
}
}
}
case 2:
{system("cls");
studentMessageDisplay(count1,count2);
system("pause");
goto loop3;
break;
}
case 0:
{cout<<"\t\t★ ★ ★ ★ ★ 謝 謝 使 用 ★ ★ ★ ★ ★"<<endl<<endl<<endl;
cout<<"\t\t★ 您好,大學生考研學院信息模塊 ★"<<endl<<endl<<endl;
cout<<"\t\t★ 歡 迎 下 次 再 來 ★"<<endl<<endl<<endl;
cout<<"\t\t★ ★ ★ 歡迎返回大學生考研信息指南主界面 ★ ★ ★"<<endl<<endl<<endl;
}
goto loop2;
break;
}
}
case 0:
{ system("cls");
for(int i=0;i<5;i++) cout<<endl;
cout<<"\t\t★ ★ ★ ★ ★ 謝 謝 使 用 ★ ★ ★ ★ ★ "<<endl<<endl<<endl;
cout<<"\t\t★ 天 地 ★"<<endl<<endl<<endl;
cout<<"\t\t★ 行 勢 ★"<<endl<<endl<<endl;
cout<<"\t\t★ 健 坤 ★"<<endl<<endl<<endl;
cout<<"\t\t★ 自 厚 ★"<<endl<<endl<<endl;
cout<<"\t\t★ 強 德 ★"<<endl<<endl<<endl;
cout<<"\t\t★ 不 載 ★"<<endl<<endl<<endl;
4. 我用C語言寫了一個學生管理系統,錄入有問題,請高手優化,運用鏈表
好啊
此題如此簡單
讓我來給你新的代碼(自己編的)
代碼如下:
#include<stdio.h>
#include<string.h>
#include<malloc.h>
#define NULL 0
#define LEN sizeof(struct student)
struct student
{
char num[10]; //學號
char name[20]; // 姓名
int age; //年齡
int sex; //性別
char regedit[20]; //籍貫
char tel_num[12]; //電話
char email[20]; //email
struct student *next; //
};
int n;
struct student * record()/* 建立信息 */
{
struct student *head,*p1,*p2;
int c;
head=p2=NULL;
n=0;
do
{
p1=(struct student *)malloc(LEN);
n=n+1;
/*p1->num='\0';
p1->name='\0';
p1->age=0;
p1->sex=0;
p1->regedit='\0';
p1->tel_num='\0';
p1->email='\0'; */
printf("\n");
printf("請輸入學生的學號:\n");
gets(p1->num);
printf("請輸入學生的姓名:\n");
gets(p1->name);
printf("請輸入學生的年齡:\n");
scanf("%d",&p1->age);
printf("請輸入學生的性別:(1代表男0代表女)\n");
scanf("%d",&p1->sex);
printf("請輸入學生的籍貫:\n");
scanf("%s",p1->regedit);
printf("請輸入學生的電話:\n");
// gets(p1->tel_num); //次行用gets 會出現錯誤
scanf("%s",p1->tel_num);
printf("請輸入學生的E-mail:\n");
//gets(p1->email); //此行一樣 用gets 會出現錯誤
scanf("%s",p1->email);
printf("\n請問是否繼續注冊?(1表示繼續 2表示停止)\n");
scanf("%d",&c);
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
}while(c==2);
p2->next=NULL;
return(head);
}
void main()
{
struct student *head;
head=record();
}
如果想要把 錄入的數據輸出 還可以在輸出
要的話 給我留言!
5. C語言編寫的學生信息管理系統的有關問題
數據結構可以用結構體,存儲學生信息,要保存為文件,要用到FILE指針,課本上一般都有,打開文件也是用file
6. C語言 學生信息管理系統 來個大神幫我看看源代碼那裡有問題
這位兄台,問題蠻多的,真的要一一列舉嗎:
入口執行代碼main函數沒有要執行的東西呀?
知道int 是什麼意思嗎?就是一個數,范圍:-4294967296 ~4294967296,號碼就是一個數,所以不需要數組啦,比如你定義的int idcardnumber[20];那是20個范圍在-4294967296 ~4294967296的數。
scanf讀數據要用取地址符號&。
你要用student 結構定義變數不需要每次都寫一次定義,只要在開頭給這個定義起個名字就好了:typedef struct student{} Student;以後要定義變數時就這樣 Student s;
if語句、定義函數要用{}要包含代碼。
先解決這些問題吧……
7. C語言學生信息管理系統中出現的問題
這是你自己寫的程序嗎?我很少使用這個類型,不太了解它的方法,要是源文件還是可以看看。下面是簡單的分析。
FILE的用法學習了嗎?
fwrite (&n,sizeof (int),1,fp2);//想文件中寫入1個int的0啊?不是要刪除嗎?
size_t fwrite(const void* buffer, size_t size, size_t count, FILE* stream);
8. C語言建立學生信息管理系統 無法初始化
這是你自己寫的程序嗎?我很少使用這個類型,不太了解它的方法,要是源文件還是可以看看。下面是簡單的分析。
FILE的用法學習了嗎?
fwrite (&n,sizeof (int),1,fp2);//想文件中寫入1個int的0啊?不是要刪除嗎?
size_t fwrite(const void* buffer, size_t size, size_t count, FILE* stream);
注意:這個函數以二進制形式對文件進行操作,不局限於文本文件
返回值:返回實際寫入的數據塊數目
(1)buffer:是一個指針,對fwrite來說,是要獲取數據的地址;
(2)size:要寫入內容的單位元組數;
(3)count:要進行寫入size位元組的數據項的個數;
(4)stream:目標文件指針;
這個例子估計能對你有幫助;
56789101112131415161718192021 //程序示例 fwrite fread fseek #include <stdio.h> int main () { FILE *fp; char msg[] = "file content"; char buf[20]; fp = fopen("d:\\a\\a.txt","w+"); if (NULL == fp) { printf("The file doesn't exist!\n"); return -1; } fwrite(msg,strlen(msg),1,fp);//把字元串內容寫入到文件 fseek(fp,0,SEEK_SET);//定位文件指針到文件開始位置 fread(buf,strlen(msg),1,fp);//把文件內容讀入到緩存 buf[strlen(msg)] = '\0';//刪除緩存內多餘的空間 printf("buf = %s\n",buf); printf("strlen(buf) = %d\n",strlen(buf)); return 0; }
哎呀呀,不好意思啊。沒看到你是.dat啊。
哈~看起來只是清除了st_num.dat,沒有清除student.dat。是不是這個問題啊,而且看起來像課後題啊。
9. 學生管理系統c語言源代碼幫我看看這程序出問題了
調了一下,沒啥大問題啊?
struct stu_type {
char num[15];
char name[10];
int age;
int xibie;
xibie定義為int,scanf和printf里用的是%s,改成%d就不報錯了。
另外case 2: display((char*)""); break; 這一行原來的過不了,強制轉換一下過了