简单的 C语言程序 纠错

来源:百度知道 编辑:UC知道 时间:2024/06/03 21:44:04
struct sth
{
int number;
char name[20];
float price;
int count;
}
goods[20];
int n=0;
#include<stdio.h>
#include<string.h>
#include<conio.h>
void init()
{
printf("Choose your choice:\n");
printf("\t①.ININ(press '0' to finish)\n");
printf("\t②.SEEK\n");
printf("\t③.COUNT(press '0' to finish)\n");
printf("\t④.PRINTF\n");
printf("\t⑤.EXIT\n");
}
void inin()
{
float t;
do
{printf("NO.:\t");
scanf("%d",&goods[n].number);
if(goods[n].number==0)
break;
printf("name:\t");
scanf("%*c%s",&goods[n].name);
printf("price:\t");
scanf("%f",&t);
goods[n].price=t;
printf("count:\t");
scanf(

也该完了,试过可以运行,错误标出(在程序里),试用我改的
1. void seek()
printf("Input error!!!!\n");
}
while(1);
2. }
还有就是没用,记得删掉

#include<stdio.h>
#include<string.h>
#include<conio.h>
struct sth
{
int number;
char name[20];
float price;
int count;
}
goods[20];
int n=0;

void init()
{
printf("Choose your choice:\n");
printf("\t①.ININ(press '0' to finish)\n");
printf("\t②.SEEK\n");
printf("\t③.COUNT(press '0' to finish)\n");
printf("\t④.PRINTF\n");
printf("\t⑤.EXIT\n");
}
void inin()
{
float t;
do
{printf("NO.:\t");
scanf("%d",&goods[n].number);
if(goods[n].number==0)
break;
printf("name:\t");
getch