卖菜控制系统
用C语言编写卖菜系统,求大神赐教,谢谢!!!
这是我写的代码有很多错误,请教大神修改
#include<stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
int i,j;
struct vegetable
{
int number;
char name[10];
char price[10];
char kilogram;
double total;
double change[1];
}
struct vegetable() ; //构建一个结构体
int menu(st); //菜单
int name(); //蔬菜名称
void data(); //添加数据
void query(); //输出
void surplus(); //结余
int main()
{
menu(vegetable);
return 0;
}
int menu()
{
int n;
int flag=1; //定义一个int型变量flag,并且给flag赋初始值为1
while(flag)
{
printf("1 -------蔬菜名称\n");
printf("2 -------添加数据\n");
printf("3 -------输出\n");
printf("4 -------总和\n");
printf("5 -------结余\n");
scanf("%d",&n);
switch(n)
{
case 1: name();break;
case 2:type();break;
case 3:query();break;
case 4:count();break;
case 5:surplus();break;
}
}
}
int main();
{
switch(name)
{
case 0:printf("蘑菇\n");break;
case 1:printf("青菜\n");break;
case 2:printf("白菜\n");break;
case 3:printf("芹菜\n");break;
case 4:printf("芦笋\n");break;
case 5:printf("胡萝卜\n");break;
case 6:printf("苋菜\n");break;
case 7:printf("莴笋\n");break;
case 8:printf("马铃薯\n");break;
case 9:printf("山药\n");break;
default:printf("Please select to vegetables!\n");
}
}
void data()
{
printf("The vegetables how much unit price: \n");
printf("Need vegetables quality: \n");
for(i=0;i<10;i++)
scanf("%d",&price[i]);
for(j=0;j<10;i++)
scanf("%d",&kilogram[j]);
}
void query
int main()
{
double add(double x,double y); //对add函数作声明
double i,j,a;
printf("Please enter i and j:");
scanf("%d,%d",&i,&j);
a=add(i,j); //调用add函数
printf("product is%d\n",a);
return 0;
}
double add(double x,double y) //定义add函数
{
float z;
z=x*y;
return (z);
}
void surplus
int main()
{
double add(double x,flaot y );
double a,b,c;
printf("Please enter a and b:");
scanf("%d,%d",&a,&b);
c=add(a,b);
printf("subtract is%d\n",c);
return 0;
}
double add(double x,double y)
{
float c;
c=x-y;
return (c);
}