void delete_name()
{
char n[10];
int i,j,b=0,m=0;
FILE *fp;
for(i=0;i<N;i++)
if(strlen(production[i].name)!=0)
m++;
if((fp=fopen("production.txt","rb+"))==NULL)
{printf("不能打开file.\n");
exit(0);
}
printf("Enter the name of the production which you want to delete!");
scanf("%s",&n);
for(i=0;i<m;i++)
if(strcmp(production[i].name,n)==0)
{
for(j=i;j<=m;j++)
production[j]=production[j+1];
b=1;
}
if(b==1)
{printf("按任意键删除它.\n");
printf("Succeed!The data has been deleted!\n");
}
if(b==0)
printf("不存在此商品!");
fwrite(&production[i],sizeof(struct production),1,fp);
fclose(fp);
remove("production.txt");
}
void search_number()
{
int number,i,flag=0;
printf("Please enter number which you want to search:");
scanf("%d",&number);
for(i=0;i<N;i++)
if(production[i].number==number&&production[i].number!=0)
{
printf("the information of this number:\n");
printf("Number: %d\nName: %s\nInprice: %d\nOutprice: %d\nQuantity: %d\n",production[i].number,production[i].name,production[i].inprice,production[i].outprice,production[i].number);
flag=1;
}
if(flag==0)
printf("The number is not exist !\n");
}
void search_name()
{char name[20];
int i,flag=0;
printf("Please enter name which you want to search:");
scanf("%s",&name);
for(i=0;i<N;i++)
if(strcmp(production[i].name,name)==0)
{ printf("the information of this name:\n");
printf("Number: %d\nName: %s\nInprice: %d\nOutprice: %d\nQuantity: %d\n",production[i].number,production[i].name,production[i].inprice,production[i].outprice,production[i].number);
flag=1;
}
if(flag==0)
printf("The name is not exist !\n");
}
跪求C语言编程高手帮忙编个小程序,大一年级的
tot=a+b+c+d+e;printf("字符串中共有:%d字符\\n大写字母:%d个\\n小写字母:%d个\\n数字:%d个\\n空格:%d个\\n其他字符:%d\\n",tot,a,b,c,d,e);for(i=0;i<tot-1;i++){ iPos = i;for(j=i+1;j<tot;j++)if(ch[j]<ch[iPos])iPos=j;iTemp = ch[i];ch[i] = ch[iPo...
请高手帮忙翻译一段c语言
return(i-1);\/\/返回读取的记录数 }
请C语言高手帮忙解释一下这个程序的每句话!!!
clrscr(); 清屏幕 c=choice(); 运行子函数choice,结果给c switch(c) 根据c的值,分别执行各个功能 { case 0:printf("\\nWelcome to this program!");break;打印欢迎信息 case 1:m=Input(stu);break; 1到6,调用各个子函数 case 2:add(stu);break;case 3:Print(stu);break;...
在网上找了一些小程序C语言代码,翻译时出现错误和警告,谁有么有,没...
include<stdio.h> void max(int a[],int n){ int i,j,t;for(i=0;i<n;i++)for(j=i+1;j<n;j++)if(a[i]<a[j]){ t=a[i];a[i]=a[j];a[j]=t;} } void main(){ int a[10],i;for(i=0;i<10;i++)scanf("%d",&a[i]);max(a,10);for(i=0;i<10;i++...
请高手帮忙,用C语言输出以下程序.
include<stdio.h> void main(){ for(int i=1;i<=10;i++){ printf("%d\\t%d\\t%d\\n",i,i*i,i*i*i);} }
...小程序,程序在网上找好了,可是看不懂,帮我翻译一下大概意思。_百度...
31,29,31,30,31,30,31,31,30,31,30,31};\/\/定义一个数组,数组一个为闰年每月的最大值,一个为平年每月的最大值 int IsLeap(int year)\/\/定义个判断是否为闰年的函数 { if(year%400==0 || (year%4==0 &&year%100!=0))return 1; \/\/是闰年返回1 else return 0; \/\/不是闰年 }...
求C语言高手帮忙~~~
int a){ int sum=0;for(int i=1;i<=a;i++){ if(a%i==0)sum++;} if (a%sum==0)return a;else { a--;return find(a);} } int main(int argc, char* argv[]){ int result=find(300);printf("%d\\n",result);return 0;} 运行结果:296 Press any key to continue ...
电脑C语言编程,求高手帮忙
int a,b,s=1;scanf("%d%d",&a,&b);printf("%d:",a);for(int i=1;i<=a;i++){ if(a%i==0){ for(int j=2;j=i){ s*=i;printf("%d*",i);} } } printf("\\b=%d,",s);if(s==b) printf("OK\\n");else printf("Err(%d!=%d)\\n",s,b);} 3.include<stdio.h...
C语言高手帮忙啊!
get_point(&c);printf("The area of triangle is:%f\\n",triangle(a,b,c));printf("输入平移向量坐标:");get_point(&n);a=add(a,n);b=add(b,n);c=add(c,n);printf("平移后三角形面积为:%f",triangle(a,b,c));} \/*旋转*\/ include include define DIM 4 define N 1 define ...
求高手帮忙写一个c语言发牌程序
void Output(int *poker, int *countA, int *countB, int *countC, int *countD);struct PokerGame { int A[NUM];\/\/记录玩家手中的黑桃牌 int B[NUM];\/\/记录玩家手中的红桃牌 int C[NUM];\/\/记录玩家手中的梅花牌 int D[NUM];\/\/记录玩家手中的方片牌 int manNum[NUM];\/\/记录玩家...