增加订单函数c语言 增加订单函数c语言怎么写

C语言高手帮帮忙//---------------------------------------------------------------------------
/*
“卖羊时根据数量超过100只那些羊每只900元 , 当超过200只时,超过200只那些羊每只800元”
这句我不理解,所以请按你自己的意思在函数Cal_Sales里修改
*/
#include stdio.h
#include conio.h
unsigned intclient_sum;
unsigned intclient_no;
unsigned intclient_buy;
unsigned intclient_trust[30];
unsigned intrancher_bank=0;
unsigned int Get_Trust(unsigned int no,unsigned int len,unsigned int *trust)
{
unsigned int i,j;
unsigned int temp;
unsigned int trust_temp;
trust_temp = trust[no-1];
for(i=0; ilen-1; i)
{
for(j=i; jlen; j)
{
if(trust[i]trust[j])
{
temp = trust[i];
trust[i] = trust[j];
trust[j] = temp;
}
}
}
for(i=0; ilen; i)
{
if(trust_temp = trust[i])
return i 1;
}
return len;
}
void Store_Money(void)
{
printf("农场主的银行存款是: %d\n\n",rancher_bank);
}
unsigned int Cal_Sales(unsigned int sum)
{
if(sum = 100)
return sum*1000;
if(sum = 200)
{
return (100*1000(sum-100)*900);
}
return (100*1000100*900 (sum-200)*800);
}
unsigned int str2int(unsigned int *dig,unsigned int *sum)
{
unsigned int i,j;
i=0;
while(dig[i] != 'E')
i;
if(i==0)
return 1;
if(i==1)
{
*sum = dig[0];
return 0;
}
j = 0;
*sum = dig[0];
for(j=1; ji; j)
{
*sum = (*sum)*10dig[j];
}
return 0;
}
int format_data(char *str,unsigned int *sum,unsigned int *no,unsigned int *buy,unsigned int *trust)
{
unsigned int i,j,k;
unsigned int digit_sum;
unsigned int digit[5];
i=0;
while(str[i] != '\0')
{
if(str[i] == ' ')
{
i;
continue;
}
if((str[i]'0') || (str[i]'9'))
return 1;
i;
}
i=0;
j=0;
while(str[i] == ' ')
i;
while(str[i] != '\0')
{
if(str[i] == ' ')
break;
digit[j] = str[i]-'0';
}
digit[j] = 'E';
if(str2int(digit,sum))
return 1;
j=0;
while(str[i] == ' ')
i;
while(str[i] != '\0')
{
if(str[i] == ' ')
break;
digit[j] = str[i]-'0';
}
digit[j] = 'E';
if(str2int(digit,no))
return 1;
j=0;
while(str[i] == ' ')
i;
while(str[i] != '\0')
{
if(str[i] == ' ')
break;
digit[j] = str[i]-'0';
}
digit[j] = 'E';
if(str2int(digit,buy))
return 1;
for(k=0; k*sum; k)
{
j=0;
while(str[i] == ' ')
i;
while(str[i] != '\0')
{
if(str[i] == ' ')
break;
digit[j] = str[i]-'0';
}
digit[j] = 'E';
if(str2int(digit,trust k))
return 1;
}
return 0;
}
void main()
{
unsigned int num;
char input[100];
char str[100];
unsigned intsales;
unsigned int trust_no;
unsigned int i,j;
while(1)
{
printf("1: 处理客户定单\n");
printf("2: 查看银行存款\n");
printf("3: Exit\n");
scanf("%d",num);
switch(num)
{
case 1:
printf("请输入客户的订单及客户的信息...\n");
scanf("%s",input);
gets(str);
i=0;
j=0;
while(input[i] != '\0')
{
i;
}
while(str[j] != '\0')
{
input[i] = str[j];
}
input[i] = str[j];
//printf("%s\n",input);
if(format_data(input,client_sum,client_no,client_buy,client_trust))
{
printf("输入错误!\n",sales);
break;
}
trust_no = Get_Trust(client_no,client_sum,client_trust);
if(trust_no = 5)
{
sales = Cal_Sales(client_buy);
rancher_bank= sales;
printf("定单金额是: %d\n\n",sales);
}
else
{
printf("不卖!\n\n");
}
break;
case 2:
Store_Money();
break;
case 3:
return;
default:
printf("请先选择一项功能...\n\n");
break;
}
}
}
//---------------------------------------------------------------------------
用c语言编一个订单信息管理程序#include stdio.h
#include string.h
#include malloc.h
#include stdlib.h
int N;//////订单数目
struct chanpin
{
long bianhao;
char mingcheng[30];
char cpmingcheng[30];
int cpdingjia;
int shuliang;
long jine;
};////订单编号、公司名称、产品名称、产品订价、订购数量、订单金额
void init(struct chanpin *p)
{
printf("输入订单编号:\t");
scanf("%d", p-bianhao);
printf("\n输入公司名称:\t");
scanf("%s", p-mingcheng);
printf("\n输入产品名称:\t");
scanf("%s", p-cpmingcheng);
printf("\n输入产品定价:\t");
scanf("%d", p-cpdingjia);
printf("\n输入订购数量:\t");
scanf("%d", p-shuliang);
p-jine=p-cpdingjia * p-shuliang;
}//初始化
void displaymingcheng(struct chanpin *p)
{
printf("\n");
printf("公司名称:%s\n", p-mingcheng);
}
void display(struct chanpin *p)
{
displaymingcheng(p);
puts("-----------------------------------------------");//传说中的分割线
printf("订单编号:\t%ld", p-bianhao);
//printf("\n公司名称:\t%s", p-mingcheng);
printf("\n产品名称:\t%s", p-cpmingcheng);
printf("\n产品定价:\t%d", p-cpdingjia);
printf("\n订购数目:\t%d", p-shuliang);
printf("\n总金额是:\t%ld", p-jine);
puts("-----------------------------------------------");
}//输出一个产品的全部信息
void displaycompany(struct chanpin *p)
{
char temp[30];
int i;
printf("输入公司名称:\t");
gets(temp);
for(i=0;iN;i)
{
if(strcmp(temp, p[i].mingcheng)==0)
display(p[i]);
}
puts("订单信息输出完毕!!!");
}///////////根据名称输出公司订单信息
void findbianhao(struct chanpin *p)
{
long temp;
int i;
printf("输入编号:\t");
scanf("%ld", temp);
for(i=0;iN;i)
{
if(temp==p[i].bianhao)
display((p i));
}
puts("根据编号查找完成!!!");
}//////根据编号查询 ....其他的查找方法我没写 , 你可以补上
void findcpmingcheng(struct chanpin *p)
{}///////产品名称查找
void findcpdingjia(struct chanpin *p)
{}////产品定价查找
int menu()
{
int x;
printf("根据公司名称输出订单输入 :\t c\n");
printf("根据编号查找输入:\t b\n");
printf("根据产品名称输入:\t m \n");
printf("根据定价查找输入:\t d \n");
printf("退出输入:\t e \n");
x=getchar();
getchar();
return x;
}
void main()
{
struct chanpin *cp;
int choic;
int i;
printf("请输入总书目:\t");
scanf("%d", N);
cp=(struct chanpin *)malloc(N*sizeof(struct chanpin));
for(i=0;iN;i)
init(cp i);//初始化所有产品
for(i=0;iN;i)
display(cp i);///显示所有产品信息
choic=menu();
while(choic!='e')
{
if(choic=='c')
displaycompany(cp);/////调用公司查找
else if(choic=='b')
findbianhao(cp);///调用编号查找
else if(choic=='m')
findcpmingcheng(cp);////调用名称查找
else if(choic=='d')
findcpdingjia(cp);
else
printf("出入错误!\n");
choic=menu();
}
puts("感谢使用");
}
C语言的题用函数实现数组数据的增加,删除,修改,查找和排序#includestdio.h
#define maxn 1024
int arr[maxn], n;
void add(int value)
{
arr[n - 1] = value;
return;
}
void del(int index)
{
int i, j;
for(i = index; in - 1; i)
arr[i] = arr[i1];
n--;
return;
}
void update(int index, int value)
{
arr[index] = value;
return;
}
void search(int index)
{
printf("%d\n", arr[index]);
return;
}
void BubbleSort(int count)
{
int i, j;
for(i = 0; icount; i)
{
for(j = count - 1; ji; j--)
{
if(arr[j]arr[j-1])
{
int temp = arr[j-1];
arr[j - 1] = arr[j];
arr[j] = temp;
}
}
}
return;
}
int main(void)
{
n = 0;
return 0;
}
飞机航班订票系统 C#include iostream
#includeconio.h
using namespace std;
#define OK 1
#define ERROR 0
typedef struct airline{
char air_num[8];
char plane_num[8];
char end_place[20];
int total;
int left;
struct airline *next;
}airline;
typedef struct customer{
char name[8];
char air_num[8];
int seat_num;
struct customer *next;
}customer;
airline *start_air()
{
airline *a;
a=(airline*)malloc(sizeof(airline));
if(a==NULL)
a-next=NULL;
return a;
}
customer *start_cus()
{
customer *c;
c=(customer*)malloc(sizeof(customer));
if(c==NULL)
c-next=NULL;
return c;
}
airline *modefy_airline(airline *l,char *air_num)
{
airline *p;
p=l-next;
for(;p!=NULL;p=p-next)
{
if(strcmp(air_num,p-air_num)==0)
{
p-left;
return l;
}
printf("NO the airline!");
return 0;
}
}
int insert_air(airline **p,char *air_num,char *plane_num,char *end_place,int total,int left)
{
airline *q;
q=(airline*)malloc(sizeof(airline));
strcpy(q-air_num,air_num);
strcpy(q-plane_num,plane_num);
strcpy(q-end_place,end_place);
q-total=total;
q-left=left;
q-next=NULL;
(*p)-next=q;
(*p)=(*p)-next;
return OK;
}
int insert_cus(customer **p,char *name,char *air_num,int seat_num)
{
customer *q;
q=(customer*)malloc(sizeof(customer));
strcpy(q-name,name);
strcpy(q-air_num,air_num);
q-seat_num=seat_num;
q-next=NULL;
(*p)-next=q;
(*p)=(*p)-next;
return OK;
}
int book(airline *a,char *air_num,customer *c,char *name)
{
airline *p=a;
customer *q=c-next;
p=a-next;
for(;q-next!=NULL;q=q-next){}
for(;p-next!=NULL;p=p-next)
{
if(p-left0)
{
printf("Your seat number is %d",(p-total-p-left 1));
insert_cus(q,name,air_num,p-total-p-left 1);
p-left--;
return OK;
}
else
{
printf("seat is full");
return 0;
}
}
}
int del_cus(customer *c,airline *l,char *name)
{
customer *p,*pr;
char air_num[8];
pr=c;
p=pr-next;
while(p!=NULL)
{
if(strcmp(p-name,name)==0)
{
strcpy(air_num,p-air_num);
l=modefy_airline(l,air_num);
pr-next=p-next;
p=pr-next;
printf("finish!");
return OK;
}
pr=pr-next;
p=pr-next;
}
printf("NO the customer!");
return ERROR;
}
int search_air(airline *head)
{
airline *p=head-next;
printf("air_num plane_num end_place total left\n");
for(;p!=NULL;p=p-next)
{
printf("%s %-10s %-8s %-8d%-8d\n",p-air_num,p-plane_num,p-end_place,p-total,p-left);
}
return OK;
}
int search_cus(customer *head)
{
struct customer *q=head-next;
printf("name air_num seat_num\n");
for(;q!=NULL;q=q-next)
{
printf("%-8s%-12s%-d\n",q-name,q-air_num,q-seat_num);
}
return OK;
}
int creat_air(airline **l)
{
airline *p=*l;
int i=0;
char *air_num[3]={"007af","008af","009af"};
char *plane_num[3]={"plane1","plane2","plane3"};
char *end_place[3]={"Beijing","Shanghai","Tianjin"};
int total[3]={100,100,100};
int left[3]={52,54,76};
for(i=0;i3;i)
insert_air(p,air_num[i],plane_num[i],end_place[i],total[i],left[i]);
return OK;
}
int creat_cus(customer **l)
{
customer *p=*l;
int i=0;
char *name[3]={"zhsan","lisi","wangwu"};
char *air_num[3]={"007af","008af","009af"};
int seat_num[3]={2,5,7};
for(i=0;i3;i)
insert_cus(p,name[i],air_num[i],seat_num[i]);
return OK;
}
void main()
{
int t=1;
customer *cus=start_cus();
airline *air=start_air();
char name[8],air_num[8],ch;
creat_air(air);
creat_cus(cus);
while(t==1)
{
printf("\n");
printf("*********************************\n");
printf("* Welcome to air firm! *\n");
printf("* book--------1 *\n");
printf("* cancel------2 *\n");
printf("* search------3 *\n");
printf("* exit--------4 *\n");
printf("*********************************\n");
ch=getch();
if(ch=='1')
{
printf("Please input a airline number:");
scanf("%s",air_num);
printf("Please input a name:");
scanf("%s",name);
book(air,air_num,cus,name);
}
else
if(ch=='2')
{
printf("Please input the cancel name:");
scanf("%s",name);
del_cus(cus,air,name);
}
else
if(ch=='3')
{
search_air(air);
printf("\n");
search_cus(cus);
}
else
if(ch=='4')
{
t=0;
}
}
}
任务:通过此系统可以实现如下功能:
录入:可以录入航班情况(数据可以存储在一个数据文件中增加订单函数c语言,数据结构、具体数据自定)
查询:可以查询某个航线增加订单函数c语言的情况(如,输入航班号,查询起降时间,起飞抵达城市,航班票价 , 票价折扣,确定航班是否满仓);
可以输入起飞抵达城市 , 查询飞机航班情况;
订票:(订票情况可以存在一个数据文件中,结构自己设定)
可以订票 , 如果该航班已经无票,可以提供相关可选择航班;
退票:可退票,退票后修改相关数据文件;
客户资料有姓名,证件号,订票数量及航班情况 , 订单要有编号 。
修改航班信息:当航班信息改变可以修改航班数据文件
要求:
根据以上功能说明,设计航班信息 , 订票信息的存储结构 , 设计程序完成功能;
在工作表定购统计B2单元格中使用COUNTIF函数,统计订购数量500以上包括500的订单数?在工作表定购统计B2单元格中使用COUNTIF函数,统计订购数量500以上包括500的订单数,公式如下:
=COUNTIF(订购情况!G:G,"=500")
公式及效果图
订购情况表
COUNTIF函数参数说明:
第一个参数:被判断是否满足第二个条件参数的条件区域;
第二个参数:被判断的条件 , 一般条件式会用双引号引起来 。
adds函数在C语言中什么意思这只是用户给自己增加订单函数c语言的程序中起的一个标识符增加订单函数c语言 , 没有规定是什么意思 。
add在英文中是“加法”增加订单函数c语言,“增加”的意思 。至于s增加订单函数c语言,可以是复数形式,也可以是表示字符串、s开头的其它意思 。
【增加订单函数c语言 增加订单函数c语言怎么写】关于增加订单函数c语言和增加订单函数c语言怎么写的介绍到此就结束了 , 不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

    推荐阅读