當前位置:首頁 » 小說閱讀 » c課程設計小說閱讀器

c課程設計小說閱讀器

發布時間: 2021-12-26 08:47:33

A. 《C語言課程設計(第3版)/程序設計語言課程設計叢書》epub下載在線閱讀,求百度網盤雲資源

《C語言課程設計(第3版)/程序設計語言課程設計叢書》電子書網盤下載免費在線閱讀

資源鏈接:

鏈接:

提取碼:481k

書名:C語言課程設計(第3版)/程序設計語言課程設計叢書


B. C語言課程設計-圖書管理系統

我只能給你個簡陋的東西。這個你還得自己慢慢改。(只要你能看懂)自己看著辦吧

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#define MAX_NUM 45

struct studenter {
int ID;
char Name[10];
int Age;
char Sex[2];
int Birthday;
char Adress[15];
char TelNum[12];
char Email[10];
};

typedef struct studenter STUDENT;

void input(STUDENT stu[],int Max,int cn);
int findStudentID(STUDENT stu[],int findID,int Max);
void DisplayInfor(STUDENT stu[],int Max);
void DispMainMenu();
void DispQueryMenu();
char choice();
int InforInput(STUDENT stu[],int cn);
void QueryInfor(STUDENT stu[],int Max);
void EditInfor(STUDENT stu[],int Max);

void DispMainMenu()
{
printf("**************學生信息管理系統1.0**************\n");
printf("\t1--學生信息錄入 \t2--學生信息修改\n");
printf("\t3--學生信息查詢 \t4--學生信息刪除\n");
printf("\t5--學生信息排序 \t0--退出\n");
printf("************************************************\n");
printf("請選擇(0--5):");
}

void DispQueryMenu()
{
printf("*****************請選擇查詢方式*****************\n");
printf("\t1--按學號查詢; \t2--按姓名查詢\n");
printf("************************************************\n");
printf("請選擇(1--2):");
}

char choice()
{
char select;
select=getche();
getch();
return (select);
}

void DisplayInfor(STUDENT stu[],int Max)
{
int i;
printf("\n 學號 姓名 年齡 性別 出生年月\t 地址\t 電話\t E-mail\n");
for(i=0;i<Max;i++)
printf("%8d %10s %2d %2s %8d %15s %12s %10s",stu[i].ID,stu[i].Name,stu[i].Age,stu[i].Sex,stu[i].Birthday,stu[i].Adress,stu[i].TelNum,stu[i].Email);
printf("\n");
}

void input(STUDENT stu[],int Max,int cn)
{
int i;
for(i=cn;i<Max+cn;i++)
{
printf("\n請輸入第%d個學生的學號 (8個字元以內):",i+1);
scanf("%d",&stu[i].ID);
printf("\n\t\t姓名(10個字元以內):");
scanf("%s",stu[i].Name);
printf("\n\t\t\t 年齡:");
scanf("%d",&stu[i].Age);
printf("\n\t\t\t性別(m或w):");
scanf("%s",&stu[i].Sex);
printf("\n\t\t 出生年月(8位):");
scanf("%d",&stu[i].Birthday);
printf("\n\t\t\t 地址:");
scanf("%s",&stu[i].Adress);
printf("\n\t\t\t 電話:");
scanf("%s",&stu[i].TelNum);
printf("\n\t\t\t E-mail:");
scanf("%s",&stu[i].Email);

}
printf("\n您的輸入信息是:\n");
DisplayInfor(stu,Max+cn);
}

int findStudentID(STUDENT stu[],int findID,int Max)
{
int i;
for(i=0;i<Max;i++)
{
if(stu[i].ID==findID)
break;
}
if(i<Max)
return i;
else
return -1;
}
int findStudentNAME(STUDENT stu[],char findNAME[10],int Max)
{
int i;
for(i=0;i<Max;i++)
{
if(!strcmp(stu[i].Name,findNAME))
break;
}
if(i<Max)
return i;
else
return -1;
}
int InforInput(STUDENT stu[],int cn)
{
int number;

printf("\n請輸入本次錄入的學生人數: ");
scanf("%d",&number);
if(number>MAX_NUM)
{
printf("您輸入的人數太多,大於%d人!\n",MAX_NUM);
return (0);
}
input(stu,number,cn) ;
return (number+cn);
}

void QueryInfor(STUDENT stu[],int Max)
{
char select;
int i;
int findID;
char findNAME[10];
DispQueryMenu();
select=choice();
switch (select)
{
case '1':
printf("\n按學號查詢\n請輸入學生的學號: ");
scanf("%d",&findID);
if ((i=findStudentID(stu,findID,Max))!=-1)
{
printf("查找結果如下:\n");
printf(" 學號 姓名 年齡 性別 出生年月\t 地址\t 電話\t E-mail");
printf("%8d %10s %2d %2s %8d %15s %12s %10s",stu[i].ID,stu[i].Name,stu[i].Age,stu[i].Sex,stu[i].Birthday,stu[i].Adress,stu[i].TelNum,stu[i].Email);
}
else
printf("您輸入的學號不存在!\n");
break;
case '2':
printf("\n按姓名查詢\n請輸入學生的姓名: ");
scanf("%s",&findNAME);
if ((i=findStudentNAME(stu,findNAME,Max))!=-1)
{
printf("查找結果如下:\n");
printf(" 學號 姓名 年齡 性別 出生年月\t 地址\t 電話\t E-mail");
printf("%8d %10s %2d %2s %8d %15s %12s %10s",stu[i].ID,stu[i].Name,stu[i].Age,stu[i].Sex,stu[i].Birthday,stu[i].Adress,stu[i].TelNum,stu[i].Email);
}
else
printf("您輸入的姓名不存在!\n");
break;
default :
printf("選擇錯誤!\n");
}
}

void EditInfor(STUDENT stu[],int Max)
{
int i;
int findID;
printf("\n請輸入學生的學號: ");
scanf("%d",&findID);
if ((i=findStudentID(stu,findID,Max))!=-1)
{
printf("姓 名: %s\n",stu[i].Name);
printf("原信息:%8d %2d %2s %8d %15s %12s %10s",stu[i].ID,stu[i].Age,stu[i].Sex,stu[i].Birthday,stu[i].Adress,stu[i].TelNum,stu[i].Email);
printf("\n 請輸入新的學號 (8個字元以內):",i+1);
scanf("%d",&stu[i].ID);
printf("\n\t\t姓名(10個字元以內):");
scanf("%s",stu[i].Name);
printf("\n\t\t\t 年齡:");
scanf("%d",&stu[i].Age);
printf("\n\t\t\t性別(m或w):");
scanf("%s",&stu[i].Sex);
printf("\n\t\t 出生年月(8位):");
scanf("%d",&stu[i].Birthday);
printf("\n\t\t\t 地址:");
scanf("%s",&stu[i].Adress);
printf("\n\t\t\t 電話:");
scanf("%s",&stu[i].TelNum);
printf("\n\t\t\t E-mail:");
scanf("%s",&stu[i].Email);
}
else
printf("您輸入的學號不存在!\n");
}
DEL(STUDENT stu[],int Max,int i)
{
for(;i<Max;i++)
{
stu[i-1].ID=stu[i].ID;
strcpy(stu[i-1].Name,stu[i].Name);
stu[i-1].Age=stu[i].Age;
strcpy(stu[i-1].Sex,stu[i].Sex);
stu[i-1].Birthday=stu[i].Birthday;
strcpy(stu[i-1].Adress,stu[i].Adress);
strcpy(stu[i-1].TelNum,stu[i].TelNum);
strcpy(stu[i-1].Email,stu[i].Email);
}
return(--Max);
}
DelInfor(STUDENT stu[],int Max)
{

int findID,i;
char findNAME[10],select;
printf("*****************請選擇刪除方式*****************\n");
printf("\t1--按學號刪除; \t2--按姓名刪除\n");
printf("************************************************\n");
printf("請選擇(1--2):");
select=choice();
switch (select)
{
case '1':
printf("\n按學號刪除\n請輸入學生的學號: ");
scanf("%d",&findID);
if ((i=findStudentID(stu,findID,Max))!=-1)
DEL(stu,Max,i);
else
printf("您輸入的學號不存在!\n");
break;
case '2':
printf("\n按姓名刪除\n請輸入學生的姓名: ");
scanf("%s",&findNAME);
if ((i=findStudentNAME(stu,findNAME,Max))!=-1)
DEL(stu,Max,i);
else
printf("您輸入的姓名不存在!\n");
break;
default :
printf("選擇錯誤!\n");

}
}

SortInforMenu(STUDENT stu[],int Max)
{
char select;
printf("*****************請選擇排序方式*****************\n");
printf("\t1--按學號排序; \t2--按姓名排序\n");
printf("************************************************\n");
printf("請選擇(1--2):");
select=choice();
if (select=='1'||select=='2')
SortInfor(stu,Max,select);
else
printf("選擇錯誤!\n");

}

SortInfor(STUDENT stu[],int Max,char i)
{
STUDENT student;
int j=0,k,l=0;
if(i=='1')
{
for(k=0;j<Max;j++)
for(;k<Max-j-1;k++)
{
if(stu[k].ID>stu[k+1].ID)
{
student.ID=stu[k+1].ID;
strcpy(student.Name,stu[k+1].Name);
student.Age=stu[k+1].Age;
strcpy(student.Sex,stu[k+1].Sex);
student.Birthday=stu[k+1].Birthday;
strcpy(student.Adress,stu[k+1].Adress);
strcpy(student.TelNum,stu[k+1].TelNum);
strcpy(student.Email,stu[k+1].Email);
stu[k+1].ID=stu[k].ID;
strcpy(stu[k+1].Name,stu[k].Name);
stu[k+1].Age=stu[k].Age;
strcpy(stu[k+1].Sex,stu[k].Sex);
stu[k+1].Birthday=stu[k].Birthday;
strcpy(stu[k+1].Adress,stu[k].Adress);
strcpy(stu[k+1].TelNum,stu[k].TelNum);
strcpy(stu[k+1].Email,stu[k].Email);
stu[k].ID=student.ID;
strcpy(stu[k].Name,student.Name);
stu[k].Age=student.Age;
strcpy(stu[k].Sex,student.Sex);
stu[k].Birthday=student.Birthday;
strcpy(stu[k].Adress,student.Adress);
strcpy(stu[k].TelNum,student.TelNum);
strcpy(stu[k].Email,student.Email);
}
printf("\n 學號 姓名 年齡 性別 出生年月\t 地址\t 電話\t E-mail\n");
for(i=0;i<Max;i++)
printf("%8d %10s %2d %2s %8d %15s %12s %10s",stu[i].ID,stu[i].Name,stu[i].Age,stu[i].Sex,stu[i].Birthday,stu[i].Adress,stu[i].TelNum,stu[i].Email);
printf("\n");
}
}
else if(i=='2')
{
for(k=0;j<Max;j++)
for(;k<Max-j-1;k++)
{
if(strcmp(stu[k].Name,stu[k+1].Name)>0)
{
student.ID=stu[k+1].ID;
strcpy(student.Name,stu[k+1].Name);
student.Age=stu[k+1].Age;
strcpy(student.Sex,stu[k+1].Sex);
student.Birthday=stu[k+1].Birthday;
strcpy(student.Adress,stu[k+1].Adress);
strcpy(student.TelNum,stu[k+1].TelNum);
strcpy(student.Email,stu[k+1].Email);
stu[k+1].ID=stu[k].ID;
strcpy(stu[k+1].Name,stu[k].Name);
stu[k+1].Age=stu[k].Age;
strcpy(stu[k+1].Sex,stu[k].Sex);
stu[k+1].Birthday=stu[k].Birthday;
strcpy(stu[k+1].Adress,stu[k].Adress);
strcpy(stu[k+1].TelNum,stu[k].TelNum);
strcpy(stu[k+1].Email,stu[k].Email);
stu[k].ID=student.ID;
strcpy(stu[k].Name,student.Name);
stu[k].Age=student.Age;
strcpy(stu[k].Sex,student.Sex);
stu[k].Birthday=student.Birthday;
strcpy(stu[k].Adress,student.Adress);
strcpy(stu[k].TelNum,student.TelNum);
strcpy(stu[k].Email,student.Email);
}
}

printf("\n 姓名 學號 年齡 性別 出生年月\t 地址\t 電話\t E-mail\n");
for(;l<Max;l++)
printf("%10s %8d %2d %2s %8d %15s %12s %10s",stu[l].Name,stu[l].ID,stu[l].Age,stu[l].Sex,stu[l].Birthday,stu[l].Adress,stu[l].TelNum,stu[l].Email);
printf("\n");
}
}

Save(STUDENT stu[],int Max)
{
int i=0 ;
FILE *fp;
if((fp=fopen("stu.txt","w+"))==NULL)
{
printf("ERROR!");
exit(0);
}
for(;i<Max;i++)
{
fprintf(fp,"%d ",stu[i].ID);
fprintf(fp,"%s ",stu[i].Name);
fprintf(fp,"%d ",stu[i].Age);
fprintf(fp,"%s ",stu[i].Sex);
fprintf(fp,"%d ",stu[i].Birthday);
fprintf(fp,"%s ",stu[i].Adress);
fprintf(fp,"%s ",stu[i].TelNum);
fprintf(fp,"%s ",stu[i].Email);
}
fclose(fp);
printf("OK!");
}

int main(int argc, char *argv[])
{
char select;
STUDENT stu[MAX_NUM];
int current_number=0;
select=0;
while(select!='0')
{
system("cls");

DispMainMenu();
select=choice();

switch(select)
{
case '0':
printf("\n您選擇的是退出測試!\n");
_beep(300,400);
continue;
case '1':
printf("\n您選擇的是信息錄入!\n");
current_number=InforInput(stu,current_number);
break;
case '2':
printf("\n您選擇的是信息修改!\n");
EditInfor(stu,current_number);
break;
case '3':
printf("\n您選擇的是信息查詢!\n");
QueryInfor(stu,current_number);
break;
case '4':
printf("\n您選擇的是刪除信息!\n");
DelInfor(stu,current_number);
break;
case '5':
printf("\n您選擇的是排序信息!\n");
SortInforMenu(stu,current_number);
break;
default:
printf("\n選擇錯誤!請重新選擇!\n");
}
system("PAUSE");
}
return (0);
Save(stu,current_number);
}

C. c語言課設小型圖書管理系統設計(c++)

試著做了下這個題,結果和你一樣前7項全解決了,就剩下第八個了,明天再試試,能做出來給你發代碼。要是我做不出來,還請你給我指點一二。

/*終於完成了,第八項也OK了。
你自己多運行幾組數據測試下,應該沒問題了
*/

// 20130718.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <string>
#include <iomanip>
#include <iostream>
using namespace std;
#define N 5

void swap(string & a,string & b)
{
string c= a;
a= b;
b= c;
}
void swap1(int & a,int & b)
{
int c=a;
a=b;
b=c;
}

class A
{
private:
string name[N];
string writer[N];
int num1[N];//書號
int price[N];
int num2[N];//數量
public:
void input();
void add();
void modify();
void cut();
void look();
void seek();
void display();
};

void A::input()
{
for(int i=0;i<N;i++)
{
int j;
cout<<"請依次輸入書名,作者,編號,單價及數量,用空格鍵分開"<<endl;

cin>>name[i];
cout<<"書名錄入成功"<<endl;
cin>>writer[i];
cout<<"作者錄入成功"<<endl;
cin>>num1[i];
cout<<"編號錄入成功"<<endl;
cin>>price[i];
cout<<"單價錄入成功"<<endl;
cin>>num2[i];
cout<<"數量錄入成功"<<endl;

cout<<"是否繼續輸入"<<endl;
cout<<"1:繼續"<<endl;
cout<<"2:退出"<<endl;
cin>>j;
if(j==1) ;
else break;
}
}

void A::add()
{
for(int i=0;i<N;i++)
{
if(name[i]==writer[i])
{
int j;
cout<<"請依次輸入書名,作者,編號,單價及數量,用空格鍵分開"<<endl;
cin>>name[i];
cout<<"書名錄入成功"<<endl;
cin>>writer[i];
cout<<"作者錄入成功"<<endl;
cin>>num1[i];
cout<<"編號錄入成功"<<endl;
cin>>price[i];
cout<<"單價錄入成功"<<endl;
cin>>num2[i];
cout<<"數量錄入成功"<<endl;

cout<<"添加成功,是否繼續添加"<<endl;
cout<<"1:是"<<endl;
cout<<"2:否"<<endl;
cin>>j;
if(j==1);
else break;
}
}
}

void A::modify()
{
int i,j;
cout<<"請輸入要修改書的書號"<<endl;
cin>>j;
for(i=0;i<N;i++)
{
if(num1[i]!=j);

else
cout<<"書籍已找到"<<endl;
cout<<"請重新輸入書名,作者,編號,單價及數量,用空格鍵分開"<<endl;
cin>>name[i];
cout<<"書名錄入成功"<<endl;
cin>>writer[i];
cout<<"作者錄入成功"<<endl;
cin>>price[i];
cout<<"單價錄入成功"<<endl;
cin>>num2[i];
cout<<"數量錄入成功"<<endl;
break;
}
}

void A::cut()
{
int i,j;
cout<<"請輸入要刪除的書的書號"<<endl;
cin>>j;
for(i=0;i<N;i++)
{
if(num1[i]==j)
{ name[i]=writer[i]=" ";
num1[i]=price[i]=num2[i]=0;
cout<<"初始化完成"<<endl;
break;
}
}

}

void A::look()
{
int i;
for(i=0;i<N;i++)
{
cout<<name[i]<<writer[i]<<num1[i]<<price[i]<<num2[i]<<endl;
}
}

void A::seek()
{
int i,j;
cout<<"請輸入要查找的書的書號"<<endl;
cin>>j;
for(i=0;i<N;i++)
{
if(j==num1[i])
cout<<num1[i]<<name[i]<<writer[i]<<price[i]<<num2[i]<<endl;
else
break;
}
}

void A::display()//排序未解決,難。。。。。
{
int i,j,k/*,P,N1,N2*/;
for(i=1;i<N;i++)
{
for(j=0;j<i;j++)
{
if(price[i]>price[j])
{
swap1(price[i],price[j]);
swap(name[i],name[j]);
swap(writer[i],writer[j]);
swap1(num1[i],num1[j]);
swap1(num2[i],num2[j]);
}
}
}
for(k=0;k<N;k++)
{
cout<<setw(5)<<price[k]<<setw(10)<<name[k]<<setw(5)<<writer[k]<<setw(3)<<num1[k]<<setw(3)<<num2[k]<<endl;
}
cout<<"排序完成"<<endl;
}

int main()
{
A a;
int i;
do
{
cout<<"1:信息錄入"<<endl;
cout<<"2:添加記錄"<<endl;
cout<<"3:信息修改"<<endl;
cout<<"4:信息刪除"<<endl;
cout<<"5:信息瀏覽"<<endl;
cout<<"6:信息查詢"<<endl;
cout<<"7:信息排序"<<endl;
cout<<"8:退出系統"<<endl;

cin>>i;

switch(i)
{
case 1:a.input();break;
case 2:a.add();break;
case 3:a.modify();break;
case 4:a.cut();break;
case 5:a.look();break;
case 6:a.seek();break;
case 7:a.display();break;
case 8:cout<<"成功退出"<<endl;break;
default:cout<<"輸入錯誤"<<endl;
}
}while(i!=8);

return 0;
}

/*終於完成了,第八項也OK了。
你自己多運行幾組數據測試下,應該沒問題了
*/

D. c語言課程設計 小型圖書管理系統設計

沒有按價格排序,自己加,可以運行
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

struct BOOK
{
int id,usr[10],total,store,days[10];
char name[31],author[21];
}books[100];
/*上面是結構體的定義,用於存放書籍及借書的信息。*/

void page_title(char *menu_item)
{

printf(">>> 圖 書 管 理 系 統 <<<\n\n- %s -\n\n",menu_item);
}
/*上面是列印頁眉的函數,同時通過參數menu_item,可以顯示當前的狀態。*/

void return_confirm(void)
{
printf("\n按任意鍵返回……\n");
getch();
}
/*上面是返回前請求確認的函數,以便在返回前觀察結果*/

int search_book(void)
{
int n,i;
printf("請輸入圖書序號:");
scanf("%d",&i);
for(n=0;n<100;n++)
{
if(books[n].id==i)
{
printf("書名:%s\n",books[n].name);
printf("作者:%s\n",books[n].author);
printf("存數:%d of ",books[n].store);
printf("%d\n",books[n].total);
return n;
}
}
printf("\n輸入錯誤或無效圖書序號.\n");
return -1;
}
/*上面的函數是在數組中找到圖書號匹配的記錄,顯示其信息並返
回數組下標,如果找不到相應記錄則提示錯誤並返回-1。*/

void book_out(void)
{
int n,s,l,d;
page_title("借閱圖書");
if((n=search_book())!=-1&&books[n].store>0)
{
printf("請輸入借書證序號:");
scanf("%d",&s);
printf("請輸入可借天數:");
scanf("%d",&d);
for(l=0;l<10;l++)
{
if(books[n].usr[l]==0)
{
books[n].usr[l]=s;
books[n].days[l]=d;
break;
}
}
books[n].store--;
}
if(n!=-1&&books[n].store==0) printf("此書已經全部借出.\n");
return_confirm();
}
/*上面是借書的函數,首先調用找書函數*/

void book_in(void)
{
int n,s,l;
page_title("歸還圖書");
if((n=search_book())!=-1&&books[n].store<books[n].total)
{
printf("借閱者圖書證列表:\n");
for(l=0;l<10;l++)
if (books[n].usr[l]!=0)
printf("[%d] - %d天\n",books[n].usr[l],books[n].days[l]);
printf("請輸入借書證序號:");
scanf("%d",&s);
for(l=0;l<10;l++)
{
if(books[n].usr[l]==s)
{
books[n].usr[l]=0;
books[n].days[l]=0;
break;
}
}
books[n].store++;
}
if(n!=-1&&books[n].store==books[n].total)
printf("全部入藏.\n");
return_confirm();
}

void book_add(void)
{
int n;
page_title("注冊新書");
for(n=0;n<100;n++)
if(books[n].id==0) break;
printf("序號:");
scanf("%d",&books[n].id);
printf("書名:");
scanf("%s",&books[n].name);
printf("作者:");
scanf("%s",&books[n].author);
printf("數量:");
scanf("%d",&books[n].total);
books[n].store=books[n].total;
return_confirm();
}
void book_del(void)
{
int n;
page_title("注銷舊書");
if((n=search_book())!=-1) books[n].id=0;
printf("該書已注銷.\n");
return_confirm();
}

void main(void)
{
menu: page_title("操作選單");
printf("請用數字鍵選擇操作\n\n");
printf("\t\t1 借閱圖書\t2 歸還圖書\n");
printf("\t\t3 注冊新書\t4 注銷舊書\n");
printf("\t\t0 退出\n");
switch(getch())
{
case '1' : book_out();break;
case '2' : book_in();break;
case '3' : book_add();break;
case '4' : book_del();break;
case '0' : exit(0);
}
goto menu;
}

E. C語言課程設計:圖書管理系統。求完整的代碼參考。

#include <iostream>
#include <fstream>
#include <string>

using namespace std;

struct BookInfo
{
char loginname[10];
char bookname[20];
char author[20];
char number[5];
char date[10];
double price;
};

struct Node
{
struct BookInfo book;
struct Node *next;
};

void option();
void select();
Node *head;
Node *pt[10];
FILE *fp;

//創建鏈表
/*
Node *CrtNode(int n)
{
Node *head; //聲明頭指針head
Node *p,*s;
head=new Node; //創建頭結點由head指向(空的頭結點)
s=head;
cout<<"請輸圖書信息:"<<endl;
for(int i=0;i<n;i++)
{
p=new Node; //創建一個結點
cout<<"登錄名:";
cin.getline(p->book.loginname,10);
strcat(p->book.loginname,"\n");
cout<<"書名:";
cin.getline(p->book.bookname,20);
strcat(p->book.bookname,"\n");
cout<<"作者名:";
cin.getline(p->book.author,20);
strcat(p->book.author,"\n");
cout<<"分類號:";
cin.getline(p->book.number,5);
strcat(p->book.number,"\n");
cout<<"出版日期:";
cin>>p->book.date;
strcat(p->book.date,"\n");
cout<<"價格:";
cin>>p->book.price;
s->next=p; //把創建的結點由s的next指向
s=p; //指針s的指向向後移一個結點
cin.clear();
cin.sync();
}
p->next=NULL; //最後一個結點的next指向空
return head; //返回頭指針
}
*/
/*
strcat(p->book.loginname,"\n");
strcat(p->book.bookname,"\n");
strcat(p->book.author,"\n");
strcat(p->book.number,"\n");
strcat(p->book.date,"\n");
*/

//1.插入
void Insert(Node *head)
{
Node *p,*s;
s = head;
cout<<"請輸入圖書信息:"<<endl;
p=new Node;
cin.clear();
cout<<"登錄名:";
cin.getline(p->book.loginname,10);
strcat(p->book.loginname,"\n");
cin.clear();
cin.sync();
cout<<"書名:";
cin.getline(p->book.bookname,20);
strcat(p->book.bookname,"\n");
cin.clear();
cin.sync();
cout<<"作者名:";
cin.getline(p->book.author,20);
strcat(p->book.author,"\n");
cin.clear();
cin.sync();
cout<<"分類號:";
cin.getline(p->book.number,5);
strcat(p->book.number,"\n");
cin.clear();
cin.sync();
cout<<"出版日期(yyyy-mm-dd):";
cin>>p->book.date;
strcat(p->book.date,"\n");
cout<<"價格:";
cin>>p->book.price;
while(s->next)
s = s->next;
s->next = p;
p->next = NULL;
}

//初始化
Node *Initial()
{
Node *head;
head = new Node;
head->next = NULL;
return head;
}

//2.顯示所有信息
void Show(Node *head)
{
int i = 1;
Node *p;
//顯示除頭結點以後所有結點(因為創建時頭結點為空)
p=head->next;
if(p == NULL)
{
cout<<"系統沒有儲存任何圖書信息,請輸入圖書信息後再進行其他操作!"<<endl;
}
else
{
cout<<"*********下面是所有的圖書信息**********"<<endl;
while(p!=NULL)
{
cout<<" 圖書"<<i<<": "<<p->book.bookname<<endl;
cout<<"登錄名:"<<p->book.loginname;
cout<<"書名:"<<p->book.bookname;
cout<<"作者名:"<<p->book.author;
cout<<"分類號:"<<p->book.number;
cout<<"出版日期:"<<p->book.date;
cout<<"價格:"<<p->book.price;
cout<<endl;
p=p->next;
i++;
cout<<endl;
}
}

cout<<"請按回車鍵返回菜單。"<<endl;
cin.get();
}

//3.查找
int findauthor(const Node *head)
{
Node *ps;
char author[20];
int count = 0;
ps = head->next;
cout<<"請輸入作者名:";
cin.getline(author,20);
strcat(author,"\n");
while(ps)
{
if(strcmp(ps->book.author,author) == 0)
{
pt[0] = ps;
count++;
}
ps = ps->next;
}
if(count == 0)
cout<<"查找的圖書不存在!"<<endl;
return count;
}

int findbookname(const Node *head)
{
Node *ps;
char bookname[20];
int count = 0;
int i = 0;
ps = head->next;
cout<<"請輸入書名:";
cin.getline(bookname,20);
strcat(bookname,"\n");
while(ps)
{
if(strcmp(ps->book.bookname,bookname) == 0)
{
pt[i] = ps;
count++;
i++;
}
if(ps->next ==NULL)
break;
ps = ps->next;
}
if(count == 0)
cout<<"查找的圖書不存在!"<<endl;
return count;
}

void Showarray(int n)
{
cout<<"*********下面是所查找的圖書信息**********"<<endl;
for(int i=0;i<n;i++)
{
cout<<" 圖書"<<i+1<<": "<<pt[i]->book.bookname;
cout<<"登錄名:"<<pt[i]->book.loginname;
cout<<"書名:"<<pt[0]->book.bookname;
cout<<"作者名:"<<pt[i]->book.author;
cout<<"分類號:"<<pt[i]->book.number;
cout<<"出版日期:"<<pt[i]->book.date;
cout<<"價格:"<<pt[i]->book.price;
cout<<endl;
}
cin.get();
}

int Find(Node *head)
{
int n,num;
system("cls");
if(head->next == NULL)
{
cout<<"系統沒有儲存任何圖書信息,請輸入圖書信息後再進行其他操作!"<<endl;
cin.get();
}
else
{
cout<<"請選擇查找方式(1.按作者名查找 2.按書名查找):";
cin>>n;
cin.clear();
cin.sync();
switch(n)
{
case 1:
num = findauthor(head);
if(num != 0)
Showarray(num);
break;
case 2:
num = findbookname(head);
if(num !=0)
Showarray(num);
break;
default:
cout<<"輸入有誤,請重新輸入!"<<endl;
cin.get();
system("cls");
option();
select();
}
}
return num;
}

//4.修改圖書信息

void Modify(Node *head)
{
Node *p,*q,*s;
p = head->next;
int i,n;
if(p == NULL)
cout<<"系統沒有儲存任何圖書信息,請輸入圖書信息後再進行其他操作!"<<endl;
else
{
cout<<"請輸入需要更正信息的圖書名:"<<endl;
n = findbookname(head);
Showarray(n);
loop:
{
cout<<"請選擇對第幾本書的信息進行修改:";
}
cin>>i;
cin.clear();
cin.sync();
if(i > 0 & i <= n)
{
cout<<"******修改第"<<i<<"本書的其他信息******"<<endl;
cout<<"登錄名:";
cin.getline(pt[i-1]->book.loginname,10);
strcat(pt[i-1]->book.loginname,"\n");
cin.clear();
cin.sync();
cout<<"作者名:";
cin.getline(pt[i-1]->book.author,20);
strcat(pt[i-1]->book.author,"\n");
cin.clear();
cin.sync();
cout<<"分類號:";
cin.getline(pt[i-1]->book.number,5);
strcat(pt[i-1]->book.number,"\n");
cin.clear();
cin.sync();
cout<<"出版日期(yyyy-mm-dd):";
cin>>pt[i-1]->book.date;
strcat(pt[i-1]->book.date,"\n");
cout<<"價格:";
cin>>pt[i-1]->book.price;
}
else
{
cout<<"選擇的書的序號有誤!";
goto loop;
}
}
cin.get();
}

//5.刪除圖書信息
void Deletebook(Node *head)
{
Node *p,*q;
char bookname[20];
int count = 0;
int i = 0;
p = head;
q = p->next;
if(q == NULL)
cout<<"系統沒有任何圖書信息!"<<endl;
else
{
cout<<"請輸入書名:";
cin.getline(bookname,20);
strcat(bookname,"\n");
while(q != NULL)
{
q = p->next;
if(strcmp(q->book.bookname,bookname) == 0)
{
p->next = q->next;
delete q;
count++;
}
p = q;
q = q->next;
}
if(count == 0)
cout<<"沒有找到該圖書信息!"<<endl;
else
cout<<"圖書信息已經刪除!"<<endl;
}
cin.get();
}

//鏈表長度
int Len(const Node *head)
{
Node *ps;
int count = 0;
ps = head->next;
while(ps)
{
count++;
ps = ps->next;
}
return count;
}

//6.保存文件

void save(Node *head)
{
Node *p;
char st[20];
p = head->next;
if((fp=fopen("book.dat", "w"))==NULL)
{
cout<<"打開文件失敗"<<endl;
return;
}
char t[255];

//將 L1.listlen() 賦予字元串中的數字
int lenth = Len(head);
fwrite(&lenth,sizeof(int),1,fp);
while(p)
{
fwrite(p,sizeof(struct Node),1,fp);
p = p->next;
}
fclose(fp);
cout<<"文件已經保存,請按ENTER鍵退出!"<<endl;
cin.get();
}

//8.刪除所有圖書信息
void Free_List(Node *head)
{
Node *p;
p = head->next;
while(p)
{
delete p;
p = head->next;
}
}

/*
void readstr(FILE *f,char *string)
{
do
{
//①: 先讀入一行文本
fgets(string, 255, f); //fgets(): 從文件 f 讀入長度為 255-1 的字元串
// 並存入到 string 中
} while ((string[0] == '/') || (string[0] == '\n'));

return;
}

*/

//讀取文件

Node *Load()
{
char c[255];
int lenth;
Node *p,*q;
head = new Node;
p = head;
if((fp=fopen("book.dat", "r"))==NULL)
{
cout<<"打開文件失敗"<<endl;
return head;
}
else
fread(&lenth,sizeof(int),1,fp);
for(int i = 0;i < lenth;i++)
{
q = new Node;
fread(q,sizeof(struct Node),1,fp);
p->next = q;
p = q;
}
p->next = NULL;
fclose(fp);
return head;
}

//9.菜單選項
void select()
{
int m,n;
cout<<"請輸入以下數字來選擇所需要的操作(1~8):";
cin.clear();
cin.sync();
cin>>n;
cin.clear();
cin.sync();
switch(n)
{
case 1:
system("cls");
Insert(head);
break;
case 2:
system("cls");
Show(head);
break;
case 3:
system("cls");
Find(head);
break;
case 4:
system("cls");
Modify(head);
break;
case 5:
system("cls");
Deletebook(head);
break;
case 6:
save(head);
break;
case 7:
exit(0);
break;
case 8:
Free_List(head);
break;
default:
break;
}

}

//10.菜單界面
void option()
{
cout<<" 圖書信息管理系統"<<endl;
cout<<"*****************************************************"<<endl;
cout<<" 1.輸入圖書信息 2.輸出圖書信息 "<<endl;
cout<<" 3.查找圖書信息 4.修改圖書信息 "<<endl;
cout<<" 5.刪除圖書信息 6.保存圖書信息 "<<endl;
cout<<" 7.退出系統 "<<endl;
cout<<"*****************************************************"<<endl;
}
int main()
{

//head = Initial();
head = Load();
while(1)
{
system("cls");
option();
select();
}
return 0;
}

F. 急求《c語言課程設計案例精編》電子書,急求!!!!最好是pdf!

以我自身經歷來看,感覺看視頻比看書效率高,畢竟理科知識不像是文科的,看書效率太低了。可能一個很簡單的知識點,自己看書得半個小時,但是懂的人就講幾句話,就能明白了。所以相比之下,還是視頻效率比看書高。選擇個適合自己的就能學懂C了。我當初看的是夏老師的,感覺挺適合我這樣初學者的。他講的不繁瑣啰嗦,都是重點,而且思維原理講的最好。能讓我理解,我感覺這點很重要。比之前看的什麼郝斌曾怡金文的那些繁瑣啰嗦聽不出重點的好多了。

G. c程序課程設計 圖書管理系統

c語言課程設計:
圖書管理系統設計,源代碼+說明書,安裝配置說明,一套,

H. C程序課程設計-圖書管理系統

#include "stdio.h"
#include<graphics.h>
#include "conio.h"
#include<stdlib.h>
#include<string.h>
#include "tp.h"
#include<mouse.h>
#include<bios.h>
FILE *fp,*p ;
void *buf=NULL;

void main()
{ void adm1(),adm2(),build(),huan(),borrow(),dele(),kaiji();
void anniu(int x1,int y1,int x2,int y2,int color,char *f);
void no();
int d=VGA,m=VGAHI;
initgraph(&d,&m,"");
setmouse(0,629,0,459);
settextstyle(3,0,1);
kaiji();
buf=jiantou(buf);
adm1();
adm2();
}

void adm1()
{ char adp[20],password[20];
int i,n=0;
textbackground(2);
cleardevice();
fp=fopen("pass","r");
if(fp==NULL) { outtext("no exit ");getch();exit(0);}
for(;;)
{ setcolor(2);
anniu(150,1,300,20,0," ");
setcolor(15);
outtext("input password:");
gotoxy(20,1);

gets(adp);
for(i=0;adp[i]!='\0';i++);
if(i==0) exit(0);
fgets(password,i+1,fp);
if(strcmp(password,adp)==0) { cleardevice();outtext("YES");getch();adm2();}
else{ n++;
cleardevice();outtext("error");
for(i=0;i<10;i++) delay(8000);
if(n==2) { cleardevice(); outtext("once again");for(i=0;i<=10;i++) delay(8000);}
if(n==3) { cleardevice(); outtext("3 second out");for(i=0;i<=10;i++) delay(8000);
exit(0);
}
}
fclose(fp);cleardevice();

}
}
void adm2()
{
char a;
int i,j,x,y;
clrscr();
cleardevice();
for(;;)
{ setbkcolor(6);
setcolor(2);
cleardevice();
anniu(12,40,190,70,15,"built a user (B)");
setcolor(2);
anniu(12,90,190,120,15,"return book (R)");
setcolor(2);
anniu(12,140,190,170,15,"borrow books (J)");
setcolor(2);
anniu(12,190,190,220,15,"delete user (D)");
setcolor(2);
anniu(12,240,190,270,15,"exit (E)");
do{

do{
i=readmouse(&x,&y,buf,1);
r.h.ah=1;
int86(0x16,&r,&r);
j=r.h.ah;
if(j!=0) switch(j){
case 0x30:a='b';break;
case 0x13:a='r';break;
case 0x24:a='j';break;
case 0x20:a='d';break;
case 0x12:a='e';break;
}
} while(i!=1&&j==0);
if((x>12&&x<190&&y>40&y<70&&i==1)||a=='b') { setcolor(2);
anniu(12,40,190,70,2,"built a user (B)");
delay(80000);
build();
}
if((x>12&&x<190&&y>90&y<120&&i==1)||a=='r') { setcolor(2);
anniu(12,90,190,120,2,"return book (R)");
delay(80000);
huan();
}
if((x>12&&x<190&&y>140&y<170&&i==1)||a=='j') {setcolor(2);
anniu(12,140,190,170,2,"borrow books (J)");
delay(80000);
borrow();
}
if((x>12&&x<190&&y>190&y<220&&i==1)||a=='d') { setcolor(2);
anniu(12,190,190,220,2,"delete user (D)");
delay(80000);
dele();
}
if((x>12&&x<190&&y>240&y<270&&i==1)||a=='e') {setcolor(2); anniu(12,240,190,270,2,"exit (E)");
closegraph();
showBMP("zz.bmp");
for(i=0;i<100;i++)delay(10000);
exit(0);
}
i=0;j=0;
}while(i==0&&j==0);

}

}
void anniu(int x1,int y1,int x2,int y2,int color,char *f)
{ setfillstyle(1,color);
rectangle(x1,y1,x2,y2);
floodfill(x1+1,y1+1,2);
setcolor(1);
outtextxy(20,y1+10,f);
}

void build()
{ FILE *f;
char id[20],name[20],sex[2],age[3],grad[50];
cleardevice();
printf("ID number:");
scanf("%s",id);
printf("name:");
scanf("%s",name);
printf("sex:");
scanf("%s",sex);
printf("grad:");
scanf("%s",grad);
p=fopen(id,"w+");
if(p==NULL) { no("can't build it");getch();adm2();}

fprintf(p,"%s ",name);
fprintf(p,"%s ",id);
fprintf(p,"%s ",sex);
fprintf(p,"%s ",grad);
no("bulid success");
getch();
fclose(p);
adm2();
}

void huan()
{
FILE *fp,*p;
char id[20],a[5][50],name[20],c;
int i=0,m,k;
cleardevice();
printf("input ID number:");
scanf("%s",id);
p=fopen(id,"r");
if(p==NULL) { no("user no exit");getch();fclose(p);adm2();}
fscanf(p,"%s",name);
fclose(p);
fp=fopen(name,"r");
while(!feof(fp)){ fscanf(fp,"%s",a[i++]); }

for(k=0;k<i-1;k++) printf("\nbook %d: %s",k+1,a[k]);
fclose(fp);
p=fopen(name,"w+");
for(;;)
{
printf("\n\npress the book number that you want to return. \n\nPress 6 if you want to return all. \n\npress 7 to cancle.\n");
scanf("%d",&m);
if(m==7)
{ for(k=0;k<i-1;k++)
{
fprintf(p,"%s ",a[k]);
}
fclose(p);
adm2();
}
if(m==6) remove(name);
if(m<6)
{
for(k=0;k<i-1;k++)
{ if(k!=m-1)
fprintf(p,"%s ",a[k]);
}
printf("book %d has returned.",m);
}
printf("\ncontinue? (Y/N)");
c=getch();
if(c=='y') continue;
if(c=='n') { fclose(p);adm2(); }
}
}

void borrow()
{ FILE *f,*m,*p;
char id[20],book[5][50],name[20],c;
int i=0,n=0,k;
window(1,1,80,25);cleardevice();
printf("please input the user's ID:");
scanf("%s",id);
m=fopen(id,"r");
if(m==NULL) {no("user no exit"); getch();fclose(m);adm2();}
fscanf(m,"%s",name);
fclose(m);
p=fopen(name,"r");
if(p==NULL);
else
{ while(!feof(p))
{
fscanf(p,"%s",book[i]);
i++;
}
i--;
for(k=0;k<i;k++) printf("\nbook %d :%s",k+1,book[k]);
}
fclose(p);
f=fopen(name,"w");
printf("\nhow many book do you want to borrow? <=4:");
do{printf("\ninput:");scanf("%d",&n); }while(i+n>=5);
for(k=i;k<i+n;k++)
{ printf("\nbook %d :",k+1);
gets(book[k]);
}
for(k=0;k<i+n;k++) fprintf(f,"%s\n",book[k]);
fputc('\0',f);
printf("success");
fclose(f);adm2();

}
void kaiji()
{ int i,j;
char a[20]="BOOK software";
setbkcolor(0);
for(i=0;i<=50;i++)
{
cleardevice();
setcolor(i/2);
line(50,100,50,350);
line(200,100,200,350);
line(350,100,350,350);
/*arc(125, 100, 0, 180,75);畫圓弧*/
ellipse(125, 100, 0, 180,75,40);/*橢圓*/
ellipse(275, 100, 0, 180,75,40);
ellipse(275, 350, 0, 180,75,40);
ellipse(125, 350, 0, 180,75,40);
settextstyle(3,0,4);
outtextxy(380,145+i,a);
settextstyle(1,0,1);
outtextxy(450,450,"procer: fuquan");
for(j=0;j<5;j++) delay(5000);
}

}

void dele()
{ FILE *fp,*f;
char id[20],a[4][20],c,b[5][50];
int i=0,j=0,k;
window(1,1,80,25);cleardevice();
printf("Input ID number:");
scanf("%s",id);
fp=fopen(id,"r");
if(fp==NULL) { no("user no exit");getch(); fclose(fp);adm2();}
else while(!feof(fp))
{ fscanf(fp,"%s",a[i++]);}
printf("\nname: %s",a[0]);
printf("\nID: %s",a[1]);
printf("\nsex: %s",a[2]);
printf("\ngrad: %s",a[3]);
f=fopen(a[0],"r");
if(f==NULL);
else {
while(!feof(f))
{ fscanf(f,"%s",b[j++]);}
for(k=0;k<j-1;k++) printf("\nbook %d: %s",k+1,b[k]);
}
printf("\nDo you want to delete? (Y/N): ");
c=getch();
fclose(fp);
fclose(f);
if(c=='y') { remove(id);remove(a[0]);no("success");getch();adm2();}
if(c=='n') adm2();
}

void no(char *f)
{ setfillstyle(1,3);
rectangle(260,200,390,220);
floodfill(301,201,1);
setcolor(1);
outtextxy(270,200,f);
}


先在當前目錄下創建一個文件名為pass的文件
輸入密碼;
然後運行
放到turbo c的bgi文件夾里運行就ok了

I. C語言課程設計 圖書借閱管理系統

首先要設計一個結構體存放借閱系統中包含的信息名,如書目,類型,數量等,然後設計主函數以制定系統的主界面或菜單界面,最後設計各種函數以實現你所設想的各種功能(函數名需要在編譯預處理階段設定,否則無法執行)。具體的例子我給不了,太長了,最少800多行呢!

熱點內容
追美科幻小說 發布:2025-10-20 08:47:35 瀏覽:538
yy小說多女完本小說推薦 發布:2025-10-20 08:28:24 瀏覽:460
穿越言情完結小說推薦 發布:2025-10-20 08:25:32 瀏覽:720
文筆好的小說推薦現代言情 發布:2025-10-20 08:02:07 瀏覽:796
小學生讀科幻小說 發布:2025-10-20 07:58:47 瀏覽:117
唯美悲傷的小說排行榜 發布:2025-10-20 07:58:10 瀏覽:340
炒雞甜又有肉的電競小說推薦 發布:2025-10-20 07:44:44 瀏覽:33
必須看的免費小說 發布:2025-10-20 07:28:26 瀏覽:682
校園男生言情小說 發布:2025-10-20 06:23:51 瀏覽:843
特污特甜的校園小說在線閱讀 發布:2025-10-20 06:23:51 瀏覽:898