谁能帮我设计一个C语言程序啊??

作者&投稿:臧柯 (若有异议请与网页底部的电邮联系)
有谁能帮设计个C语言程序吗?挺急的。。。。。。~

C语言之所以命名为C,是因为 C语言源自Ken Thompson发明的B语言,而 B语言则源自BCPL语言。

1967年,剑桥大学的Martin Richards对CPL语言进行了简化,于是产生了BCPL(Basic Combined Programming Language)语言。

20世纪60年代,美国AT&T公司贝尔实验室(AT&T Bell Laboratory)的研究员Ken Thompson闲来无事,手痒难耐,想玩一个他自己编的,模拟在太阳系航行的电子游戏--Space Travel。他背着老板,找到了台空闲的机器--PDP-7。但这台机器没有操作系统,而游戏必须使用操作系统的一些功能,于是他着手为PDP-7开发操作系统。后来,这个操作系统被命名为--UNIX。

1970年,美国贝尔实验室的 Ken Thompson,以BCPL语言为基础,设计出很简单且很接近硬件的B语言(取BCPL的首字母)。并且他用B语言写了第一个UNIX操作系统。

1971年,同样酷爱Space Travel的Dennis M.Ritchie为了能早点儿玩上游戏,加入了Thompson的开发项目,合作开发UNIX。他的主要工作是改造B语言,使其更成熟。

1972年,美国贝尔实验室的 D.M.Ritchie 在B语言的基础上最终设计出了一种新的语言,他取了BCPL的第二个字母作为这种语言的名字,这就是C语言。

1973年初,C语言的主体完成。Thompson和Ritchie迫不及待地开始用它完全重写了UNIX。此时,编程的乐趣使他们已经完全忘记了那个"Space Travel",一门心思地投入到了UNIX和C语言的开发中。随着UNIX的发展,C语言自身也在不断地完善。直到今天,各种版本的UNIX内核和周边工具仍然使用C语言作为最主要的开发语言,其中还有不少继承Thompson和Ritchie之手的代码。

在开发中,他们还考虑把UNIX移植到其他类型的计算机上使用。C语言强大的移植性(Portability)在此显现。机器语言和汇编语言都不具有移植性,为x86开发的程序,不可能在Alpha,SPARC和ARM等机器上运行。而C语言程序则可以使用在任意架构的处理器上,只要那种架构的处理器具有对应的C语言编译器和库,然后将C源代码编译、连接成目标二进制文件之后即可运行。

1977年,Dennis M.Ritchie发表了不依赖于具体机器系统的C语言编译文本《可移植的C语言编译程序》。

C语言继续发展,在1982年,很多有识之士和美国国家标准协会为了使这个语言健康地发展下去,决定成立C标准委员会,建立C语言的标准。委员会由硬件厂商,编译器及其他软件工具生产商,软件设计师,顾问,学术界人士,C语言作者和应用程序员组成。1989年,ANSI发布了第一个完整的C语言标准--ANSI X3.159-1989,简称"C89",不过人们也习惯称其为"ANSI C"。C89在1990年被国际标准组织ISO(International Standard Organization)一字不改地采纳,ISO官方给予的名称为:ISO/IEC 9899,所以ISO/IEC9899: 1990也通常被简称为"C90"。1999年,在做了一些必要的修正和完善后,ISO发布了新的C语言标准,命名为ISO/IEC 9899:1999,简称"C99"。 在2011年12月8日,ISO又正式发布了新的标准,称为ISO/IEC9899: 2011,简称为"C11"。

http://x.soso.com/cgi-bin/rssearch/rssearch?sp=&sc=web&cid=w.q.in.sb.web&ty=1&bn=&op=&kw=&Pkey=%A1%B6C%D3%EF%D1%D4%B3%CC%D0%F2%C9%E8%BC%C6%A1%B7%B5%E7%D7%D3%CA%E9&Psort=0&PShowType=2&PShowOrder=2&PFileTye=&Ppage=1&w=%A1%B6C%D3%EF%D1%D4%B3%CC%D0%F2%C9%E8%BC%C6%A1%B7%B5%E7%D7%D3%CA%E9&button=%CB%D1%CB%F7

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define null 0
int n=0;
struct goods
{long number;
char kind[15];
char name[15];
long price;
char address[15];
long batchnumber;
struct goods *next;
};
struct goods *creat();
void save_n();
void save_file(struct goods *head);
void load_n();
struct goods *load_file();
void output(struct goods *head);
void swap(struct goods *p1,struct goods *p);
struct good * kind_search(char kind[],struct goods *head,int * i);
struct goods *kind_sort(struct goods *head,int i);
void kind_output();
void research(struct goods *head);
struct goods *del(struct goods *head);
struct goods *appendNode(struct goods *head);
struct goods *modify(struct goods *head);
menu();

void main()
{struct goods *head;
int ch;
head=null;
while(1)
{clrscr();
menu();
printf("\nplease input you choice:");
scanf("%d",&ch);
switch(ch)
{case 1:clrscr();
head=creat();
break;
case 2:clrscr();
research(head);
printf("\nplease press any key to continue!\n");
getch();
break;
case 3:clrscr();
head=appendNode(head);
printf("\nplease press any key to continue!\n");
getch();
break;
case 4:clrscr();
head=del(head);
printf("\nplease press any key to continue!\n");
getch();
break;
case 5:clrscr();
head=modify(head);
printf("\nplease press any key to continue!\n");
getch();
break;
case 6:clrscr();
kind_output();
printf("\nplease press any key to continue!\n");
getch();
break;
case 7:clrscr();
output(head);
printf("\nplease press any key to continue!\n");
getch();
break;
case 8:clrscr();
save_file(head);
break;
case 9:clrscr();
head=load_file();
break;
case 0:exit(0);
default:printf("\nchoice error!please input right chioce!\n");
getch();
break;
}}}

struct goods *creat()
{struct goods *p1,*p2,*head;
char ch='y';
n=0;
p1=(struct goods *)malloc(sizeof(struct goods));
head=p2=p1;
if(p1==null){printf("\nlist out\n");exit(0);};
printf("\nenter the information:\n");
printf("\nnumber\tkind\tname\tprice\taddress\tbatchnumber\n");
scanf("%ld %s %s %ld %s %ld",&p1->number,p1->kind,p1->name,&p1->price,p1->address,&p1->batchnumber);
while(ch=='Y'||ch=='y')
{n=n+1;
if(n==1)head=p1;
else p2->next=p1;
printf("\nDo you want to continue(Y/N)?\n");
scanf("%s",&ch);
if(ch=='n'||ch=='N')break;
p2=p1;
p1=(struct goods *)malloc(sizeof(struct goods));
printf("\nnumber\tkind\tname\tprice\taddress\tbatchnumber\n");
scanf("%ld %s %s %ld %s %ld",&p1->number,p1->kind,p1->name,&p1->price,p1->address,&p1->batchnumber);}
p1->next=null;
return(head);}

void research(struct goods *head)
{struct goods *p1;
long number;
printf("\nplease input the number you want to search:\n");
scanf("%ld",&number);
p1=head;
while(p1!=null&&p1->number!=number)
{p1=p1->next;}
if(p1==null)
printf("\nnot find!\n");
else
{ printf("\nnumber\tkind\tname\tprice\taddress\tbatchnumber\n");
printf("%ld\t%s\t%s\t%ld\t%s\t%ld\n",p1->number,p1->kind,p1->name,p1->price,p1->address,p1->batchnumber);}}

struct goods *appendNode(struct goods *head)
{struct goods *p1,*p2;
p2=(struct goods *)malloc(sizeof(struct goods));
if(p2==null){printf("\nappend error\n");return(head);}
if(head==null)
{head=p2;}
else
{p1=head;
while(p1->next!=null)
{p1=p1->next;}
p1->next=p2;}
printf("\nplease input the information you want to add:\n");
printf("\nnumber\tkind\tname\tprice\taddress\tbatchnumber\n");
scanf("%ld %s %s %ld %s %ld",&p2->number,p2->kind,p2->name,&p2->price,p2->address,&p2->batchnumber);
p2->next=null;
n=n+1;
return(head);}

struct goods *del(struct goods *head)
{ struct goods *p1,*p2;
long number;
int flag;
printf("\nplease input the number you want to del:\n");
scanf("%ld",&number);
p1=p2=head;
if(head==null)
{printf("\n no memory!\n");return(head);}
while(p1->next!=null&&p1->number!=number)
{p2=p1;
p1=p1->next;
}
if(p1->number==number)
{if(head==p1)
head=head->next;
else
p2->next=p1->next;
printf("\nDelete sucessfully!\n");
n=n-1;
save_n();
save_file(head);}
else printf("\nnot found!\n");
return(head);}

struct goods *modify(struct goods *head)
{struct goods *p1,*p;
long number;
printf("\nplease input the number you want to modify:\n");
scanf("%ld",&number);
p1=head;
while(p1!=null&&p1->number!=number)
{p1=p1->next;}
if(p1==null)
printf("\nnot find!\n");
else
{printf("\nnumber\tkind\tname\tprice\taddress\tbatchnumber\n");
printf("%ld\t%s\t%s\t%ld\t%s\t%ld\n",p1->number,p1->kind,p1->name,p1->price,p1->address,p1->batchnumber);
printf("\nenter the information:\n");
printf("\nnumber\tkind\tname\tprice\taddress\tbatchnumber\n");
scanf("%ld %s %s %ld %s %ld",&p->number,p->kind,p->name,&p->price,p->address,&p->batchnumber);
p1->number=p->number;
strcpy(p1->kind,p->kind);
strcpy(p1->name,p->name);
p1->price=p->price;
strcpy(p1->address,p->address);
p1->batchnumber=p->batchnumber;
printf("\nmodify sucessfully!\n");
}
return(head);
}

void kind_output()
{struct goods *head;
int i;
char kind[15];
printf("\nplease input the kind you want to search:\n");
scanf("%s",kind);
head=kind_search(kind,head,&i);
head=kind_sort(head,i);
output(head);}

struct good * kind_search(char kind[],struct goods *head,int * i)
{struct goods *p,*p1,*p2,*head0;
* i=0;
p=head;
while(p!=null)
{if(strcmp(kind,p->kind)==0)
{p1=(struct goods*)malloc(sizeof(struct goods));
*i=*i+1;
p1->number=p->number;
strcpy(p1->kind,p->kind);
strcpy(p1->name,p->name);
p1->price=p->price;
strcpy(p1->address,p->address);
p1->batchnumber=p->batchnumber;
if(*i==1)head0=p2=p1;
else p2->next=p1;
p2=p1;}
p=p->next;}
p1->next=null;
if(*i==0)head0=null;
return(head0);}

struct goods *kind_sort(struct goods *head,int i)
{struct goods *p1;
int j,k;
p1=head;
for(j=0;j<i-1;j++)
{p1=head;
for(k=0;k<i-1-j;k++,p1=p1->next)
if(ascending(p1->price,p1->next->price))
swap(p1,p1->next);}
return(head);}

void swap(struct goods *p1,struct goods *p)
{long temp;
char array[15];
temp=p1->number;
p1->number=p->number;
p->number=temp;

strcpy(array,p1->kind);
strcpy(p1->kind,p->kind);
strcpy(p->kind,array);

strcpy(array,p1->name);
strcpy(p1->name,p->name);
strcpy(p->name,array);

temp=p1->price;
p1->price=p->price;
p->price=temp;

strcpy(array,p1->address);
strcpy(p1->address,p->address);
strcpy(p->address,array);

temp=p1->batchnumber;
p1->batchnumber=p->batchnumber;
p->batchnumber=temp;}

int ascending(long a,long b)
{if(a<b)return 1;
else return 0;}

void output(struct goods *head)
{ struct goods *p1;
p1=head;
if(head==null){printf("\nlist out\n");return;}
printf("\nnumber\tkind\tname\tprice\taddress\tbatchnumber\n");
for(;p1!=null;p1=p1->next)
printf("%ld\t%s\t%s\t%ld\t%s\t%ld\n",p1->number,p1->kind,p1->name,p1->price,p1->address,p1->batchnumber);}

void save_n()
{FILE * fp;
if((fp=fopen("n.txt","wb"))==NULL)
{printf("\ncan't open!\n");
exit(1);}
fprintf(fp,"%d",n);}

void save_file(struct goods *head)
{FILE * fp;
struct goods *p;
int i;
if((fp=fopen("product.txt","wb"))==NULL)
{printf("\ncan't open!\n");
exit(1);}
p=head;
while(p!=null)
{if(fwrite(p,sizeof(struct goods),1,fp)!=1)
{ printf("file write error\n"); exit(1);}
p=p->next;}
fclose(fp);
save_n();
printf("\nsave sucessfully!please press any key to continue!\n");
getch();}

void load_n()
{FILE * fp;
if((fp=fopen("n.txt","rb"))==null)
{printf("\ncan't open file\n");return;}
fscanf(fp,"%d",&n);
fclose(fp);}

struct goods *load_file()
{struct goods *head,*p1,*p2;
FILE * fp;
int i;
p1=(struct goods *)malloc(sizeof(struct goods));
head=p2=p1;
if((fp=fopen("product.txt","rb"))==null)
{printf("\ncan't open file\n");return;}
load_n();
for(i=0;i<n;i++)
{fread(p1,sizeof(struct goods),1,fp);
p2->next=p1;
p2=p1;
p1=(struct goods *)malloc(sizeof(struct goods));}
p2->next=null;
close(fp);
output(head);
printf("\nload sucessfully!please press any key to continue!\n");
getch();
return(head);
}

menu()
{printf("*************************************\n");
printf(" welcome to \n");
printf(" warehouse management \n");
printf(" system \n");
printf("*************************************\n");
printf(" 1. enter date \n");
printf(" 2. search number \n");
printf(" 3. append date \n");
printf(" 4. delete date \n");
printf(" 5. modify date \n");
printf(" 6. search kind \n");
printf(" 7. output all date \n");
printf(" 8. save date \n");
printf(" 9. load date \n");
printf(" 0. exit \n");
printf("*************************************\n");
}

链表本质练你的指针的,个人建议你还是自己做吧,指针很重要的,面向对象的引用,类,数据库,读文件流。触类旁通。你要是这都没信心自己做,那就别学了,没什么前途了。链表本质就是你指向一个队伍,然后对队伍的成员的多少和位置作出改变。你如果是自学理解不了的话,象这个题,你可以先去学数据库,知道字段和记录,学会插入字段和记录,你就能掌握了,本质上就是个二维数组。a1 b1 c1 d1 e1
a2 b2 c2 d2 e2
a3 b3 c3 d3 e3
后面的数字就是5个数据项,学号,姓名,三门课的成绩。
三行代表了3个学生的5个数据项的信息。
这题没什么难的啊。链表你只要知道指针的定位,插入和删除没什么难的。

题目太长了,没几个人有耐心看完的。


C语言编写一个程序,求x> y的运行结果
以下是一个简单的C语言程序,可以比较两个整数x和y,并打印出相应的结果:在这个程序中,我们首先声明了两个整数变量x和y,然后使用printf函数提示用户输入两个整数。接下来,我们使用scanf函数读取用户输入的整数,并将它们存储在变量x和y中。然后,我们使用一个if-else语句来比较x和y的值。如果x大于y...

c语言程序设计新猜数游戏,刚接触c语言不太会,有没有人能帮忙解答一下...
printf("玩家C得分:%d分\\n", scoreC);return 0;} ```以上代码中,通过rand()函数生成1到100之间的随机数,然后进入游戏循环。在循环中,程序提示当前玩家输入自己猜测的数字,并根据输入进行相应处理,包括判断输入是否有效、扣除相应的分数、输出下一步应该猜测的范围等。如果某个玩家猜中了答案,...

C语言程式设计:输入一个整数并能逐位正序或反位输出,用递回完成。_百度...
要把整数逐位输出,无论正序还是反序,都需要将各个位分离。在C中的做法就是,通过对10取余,取出个位,然后通过除以10,起到“移位”的效果。二、演算法设计:1、输入要处理的整数;2、取出各位;3、递回呼叫,以当前值除以10为引数;4、当值为0时退出。正序和反序输出,取决于递回呼叫和输出的...

c语言设计一个简单的计算器程序
#include<stdio.h>//计算器 voidmenu()//自定义的菜单界面 { printf("---\n");printf("请输入你的选择\n");printf("1.+\n");printf("2.-\n");printf("3.*\n");printf("4./\n");printf("---\n");} intmain(){ int...

设计C语言程序,统计一个班(最多有35人)的学生成绩
具体要求如下:(1)每个功能为一个独立的函数。(2)所有的输入之前都要有提示。请29号晚上之前给我程序,急需!!!(或者把第(2)(3)两个功能的程序给我也行,但一定要是运用结构体的)谢谢了!!请请...一定要是c语言的啊~楼下的虽然写的很长但对我没有太大的帮助啊~尽量用数组啊~万分感谢!! 展开  ...

运用C语言设计一个电子宠物程序,实现下列基本功能。
intnum;\/\/这里使用数组解决通讯录的问题,实际上使用链表更好。intmenu_select(){chars[80];inta;\/*定义整形变量*\/system("cls");printf("\\t\\t***欢迎进入通讯管理界面***\\n\\n");printf("\\t\\t\\t0.输入记录\\n");printf("\\t\\t\\t1.显示记录\\n");printf("\\t\\t\\t2.按姓名查找\\n")...

用c语言设计一个超市管理系统程序,要求能添加商品,能查询商品,能购买商 ...
include<string.h> \/\/欢迎界面\/\/ void welcome();\/\/功能浏览\/\/ void mainMenu();\/\/购物结算\/\/ void saleCalc();\/\/进货管理\/\/ void addGoods();\/\/修改信息 void updateGoods();\/\/显示商品\/\/ void showGoods();\/\/删除商品\/\/ void deleteGoods();\/\/查询商品\/\/ int searchGoods();\/\/购买...

谁能帮我用C语言设计一个有奖评选程序?题目是:十佳运动员评选活动(一...
我的 谁能帮我用C语言设计一个有奖评选程序?题目是:十佳运动员评选活动(一、功能要求 50 一、功能要求(1)20个候选人名单。运动员编号姓名01小明…20小丹(!!!每张选票可以选10个人,每个人有1张选票!!)(2选票编号0000001投票人姓名地址拟选运动员编号(3)统计任务:①统计... 一、功能要求(1)20个候选人名...

求用C语言编写一个简单的学生信息管理程序和课程设计报告
求用C语言编写一个简单的学生信息管理程序,能实现对学生信息的简单管理。要求:建立一个4个学生的信息登记表,每个学生的信息包括:学号,姓名,和3门课程的成绩(FOX,C,ENGLISH)。... 求用C语言编写一个简单的学生信息管理程序,能实现对学生信息的简单管理。要求:建立一个4个学生的信息登记表,每个学生的信息包括:...

设计一个C语言程序,要求能求一个班级学生的总分和平均分
{ int n,i;float *score;float sum=0.0,ave=0.0;printf("请输入班级学生人数:");scanf("%d",&n);score=(float *)malloc(n*sizeof(float));printf("请输入%d个学生的成绩:\\n",n);for(i=0;i<n;i++){ scanf("%f",&score[i]);sum=sum+score[i];} ave=sum\/n;printf("...

松桃苗族自治县17722524966: 急!请帮忙编一个标准c语言程序! -
诗应复方: void main(){char text[N] = gets();int base = 0, offset = 0;while(base+4<=strlen(text)){switch(text[base])

松桃苗族自治县17722524966: 求帮C语言写个程序
诗应复方: #include<stdio.h> #include<string.h> #define N 3 typedef struct student { int num;//学号 char name[10];//姓名 float grade[6];//四科成绩,平均分和总分 }STUDENT;/*输入学生信息*/ void Input(STUDENT stu[]) { int i=0; for(i=0; i<N; i++) { printf...

松桃苗族自治县17722524966: 哪位朋友能帮忙写个C程序啊?!非常感谢! -
诗应复方: #include <stdio.h>void main(){ int n, m; int a[33]; int i = 0; printf("十进制整数: "); scanf("%d", &n); printf("进制: "); scanf("%d", &m); while (n) { a[i] = n % m; i++; n /= m; } i--; while (i >= 0) { printf("%d", a[i]); i--; }}

松桃苗族自治县17722524966: 谁帮我编个c语言程序? -
诗应复方: /*先定义常量M和N,你可以随意修改*/#define M 9#define N 8/*先写个过程,输出数组*/void print_arr(int a[M][N]){int i,j;for (i=0;i<N;j++) print...

松桃苗族自治县17722524966: 有谁会C语言的吗?帮忙设计一个程序 -
诗应复方: #include void add(int a, int b) { printf("%d\n", a+b); } void reduce(int a, int b) { printf("%d\n", a-b); } void Multiplication(int a, int b) { printf("%d\n", a*b); } void division(int a, int b) { printf("%d\n", a/b); } int main() { int a, b; printf("请输入第...

松桃苗族自治县17722524966: 谁能帮我编一个c语言程序啊,在下感激不尽,,, -
诗应复方: 第二个问题代码如下:#include <stdio.h>struct Worker{ char *TestNumber;//考号 char *Name; bool Gender; int Grades;};struct Worker workers[10];void Insert(char *TestNumber1,char *Name1,bool Gender1,int Grades1,int i){ workers[i].TestNumber...

松桃苗族自治县17722524966: 谁能帮我编一个C语言程序
诗应复方: #include <windows.h> #include <process.h> #include <conio.h> #include <tchar.h> HANDLE hThrd1, hThrd2; unsigned int __stdcall ThrdProc1(void* args) { static TCHAR szBuf[64]; DWORD time = *(int*)args + 1; COORD coord = {31, 10}; ...

松桃苗族自治县17722524966: 帮我用c语言设计一个程序
诗应复方: 给你写一个很简单的加法的程序 #include<stdio.h> void main() { int a,b,c; scanf("%d%d",&a&b); c=a+b; printf("%d",c); } 输入一个数,空格,再输一个数,回车,就得到两数之和

松桃苗族自治县17722524966: 请大家帮我设计一道C程序,什么内容都可以,只要正确,语句在200?
诗应复方: #include #define NULL 0 #define LEN sizeof(struct student) struct student {long num; ... 使用WIN-TC可以直接打开就可以编译了. 这个是我曾经做过的实验课程设计,可能...

松桃苗族自治县17722524966: 帮我编一个C语言编程,如果可以顺便讲解下,谢谢! -
诗应复方: #include int main(void){ int a[100]; int i = 0, sum = 0; while (scanf("%d", &a[i]) != EOF 0) i++; ...

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网