计算机软件基础提交的作业

c语言编写的一个简单超市管理系统

计算机软件基础

1 nokia手机elec 2400.00 件20

2 燕麦面包food 5.40 袋50

3 打印机offi 800.00 台2

4 去屑洗发水comm 14.80 瓶150

5 空气加湿器comm 154.00 台30

#include "stdio.h" /*输入,输出头文件*/

#include "stdlib.h" /*申请空间头文件*/

#include "string.h" /*对字符串加工头文件*/

#include "conio.h" /*清屏头文件*/

FILE *fp;

int n=0; /*定义文件指针类型*/

int i,j,a[4],m; /*定义整数类型*/

float aver[4],sum[4],g[4],h; /*定义浮点类型*/

char c[5]="elec"; /*定义字符数组类型*/

char d[5]="comm"; /*定义字符数组类型*/

char e[5]="food"; /*定义字符数组类型*/

char f[5]="offi"; /*定义字符数组类型*/

struct good /*定义结构体*/

{

int num; /*商品编号*/

char name[20]; /*商品名称*/

char kind[40]; /*商品类型*/

float price; /*商品价格*/

char unit[10]; /*商品单位*/

int quantity; /*商品数量*/

struct good *next; /*定义结构体指针类型*/

}*head,*p1,*p2;

struct good *createlist() /*创建链表函数*/ {

struct good *head1,*p1,*p2; /*定义结构体指针类型*/

if((fp=fopen("goods message.txt","w"))==NULL) /*判断能否打开文件*/

{

printf("can not open the file");

exit(0); /*结束程序*/

}

计算机软件基础提交的作业相关文档

最新文档

返回顶部