
autu
auto自动?
break
终止循环
case
情况,
char
字符
const
定数
continue
继续循环
default
初值
do
进行循环
double
倍字节数字
else
其它情况
if
如果
int
整数
long
长数(在定义数字时用的)
register
存储器
return
返回
short
短数
signed
有正搜做负数
sizeof
字符长
static
静态
struct
结构
switch
转向
typedef
定义格式
union
组
unsigned
无正负数
void
无效
volatile
波动
while
当
enum
计数
extern
外部
float
浮点数
for
由
goto
转向
#include <stdio.h>//包含头文件羡困#include <stdlib.h>//包含头文件
int main(int argc, char *argv[])//定义入口主函数main 此函数返回一个int值,有两个参数
{
int a,b,c,d//定义4个 int型变兄激念量 abcd
scanf("%d",&d)//从键盘输入流中读取一个int型数值到变量d中 相当于d=某数值
for(a=1a<=da++)//开始循环 从1开始 到d结束 循环d次
{
for(b=1b<=d-ab++)//循环嵌套 同理
printf(" ")//在屏幕打印一个空格
for(c=1c<=2*a+d-2c++)//循环 同理
printf("*")//打印星号
printf("\n")//打印一个换行符
}
system("PAUSE")//程铅扒序暂停 等待输出
return 0//返回0
}//程序结束 退出
// 这部分用来包含需要使用的头文件,你懂的#include<stdio.h>
#include<stdlib.h>
#include<string.h>
// 这部分声明一个叫做 book 的结构体,用来存放一本书的书本信息
struct book{
// 书本名字
char book_name[30]
// 书本的编号
int bianhao
// 书本的价格
double price
// 书本的作者
char author[20]
// 书本目前的货存状态
char state[20]
// 书本借厅液给一个叫做 name 的人
char name[20]
// 书本借给了男子还是女子
char sex[10]
// 书本借给学号为 xuehao 的人
int xuehao
// 这个字段是指向 book 结构体的指针,说明作者想用链表来储存或者 *** 作所有的书本信息
struct book *book_next
}
// 借书人的个人信息(大概是这样)
struct club{
char name[20]
char sex[10]
int xuehao
// 借的书的书名
char borrow[30]
// 链表指针
struct club *club_next
}
void Print_Book(struct book *head_book)/*浏览所有图书信息*/
void Print_Club(struct club *head_club)/*浏览所有会员信息*/
struct book *Create_New_Book()/*创建新的图书库,图书编号输入为0时结束*/
// 根据给定的书本编号来查找书本信息
struct book *Search_Book_bianhao(int bianhao,struct book *head_book)
// 根据给定的书本名字来查找书本信息
struct book *Search_Book_name(char *b_name,struct book *head_book)
// 根据给定的书本价格来查找书本信息
struct book *Search_Book_price(double price_h,double price_l,struct book *head_book)
/扮没物/ 在链表中插入一个新的节点
struct book *Insert_Book(struct book *head_book,struct book *stud_book)/*增加图书,逐个添加*/
// 在链表中删除一个节点
struct book *Delete_Book(struct book *head_book,int bianhao)/*删除图书*/
// 创建一个新的借书人的信息结构体
struct club *Create_New_Club()
// 根据给定的借书人的学号来查找借书人的信息
struct club *Search_Club_xuehao(int xuehao,struct club *head_club)
// 根据给定的借书人的姓名来查找借书人的信息
struct club *Search_Club_name(char *c_name,struct club *head_club)
// 在借书人信息察饥链表中插入新节点
struct club *Insert_Club(struct club *head_club,struct club *stud_club)
// 在借书人信息链表中删除节点
struct club *Delete_Club(struct club *head_club,int xuehao)
// 借出一本书
struct book *Lent_Book(int bianhao,int xuehao,struct book *head_book,struct club *head_club)
// 归还一本书
struct book *back(int bianhao,int xuehao,struct book *head_book,struct club *head_club)
// 控制台程序入口点函数
int main()
{
// 接下来这里是创建一大堆需要用到的变量
struct book *head_book,*p_book
char book_name[30],name[20],author[20],sex[10]
int bianhao
double price,price_h,price_l
int size_book=sizeof(struct book)
int m=1,n=1,f
char *b_name,*c_name
struct club *head_club,*p_club
int xuehao
int size_club=sizeof(struct club)
全手打,希望能够帮到楼主
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)