高分悬赏:小弟急需TC编辑器下的C语言程序(100句左右)!!

内容不限!!有意者速答!!谢谢!!... 内容不限!!有意者速答!!谢谢!! 展开
 我来答
Harbin_Hit
2009-06-10 · TA获得超过481个赞
知道小有建树答主
回答量:192
采纳率:0%
帮助的人:149万
展开全部
我发给你, 在Hi里告诉下你邮箱

/***********************************************************************
* copyright (c) 2007

* 日期 : Nov,22th,2007
* 功能 : 本程序实现了以下功能:
1.计算每个学生的总分和平均分
2.按总分成绩有高到低排出成绩的名次
3.打印出名次表,表格内包括学生编号、各科分数、总分和平均分。
4.任意输入一个学号,能够查找出该学生在班级中的排名及其考试分数。
************************************************************************/
#include "stdio.h"
#include "time.h"
#include "stdlib.h"

#define TABLE_HEAD " Rank NO. Math Eng Phy Total Ave\n"
#define DATA stu[i].rank,stu[i].num,stu[i].math,stu[i].eng,stu[i].phy,stu[i].total,stu[i].ave

int n,i,j,m,k,l; /*定义宏观变量以及结构体struct student*/
struct student
{
int rank,num,math,eng,phy,total;
float ave;
};
struct student stu[30]; /*定义结构体变量数组stu[30]*/

main()
{
void sort_form();
void print_form();
void search_one();
printf("please input the number of the student:");
scanf("%d",&n);
printf("\n");
srand(time(NULL));
for(i=1;i<=n;i++)
{
stu[i].rank=i;
stu[i].num=i;
stu[i].math=rand()%40+60;
stu[i].eng=rand()%40+60; /*赋值 萁中各科分数以时钟作种子随机产生*/
stu[i].phy=rand()%40+60;
stu[i].total=stu[i].math+stu[i].eng+stu[i].phy;
stu[i].ave=(float)stu[i].total/3; /*计算总分和平均分*/
}
sort_form(); /*调用子函数sort_form()*/
print_form(); /*调用子函数print_form()*/
search_one(); /*调用子函数search_one()*/
}

/*****************************
功能:根据成绩表对学生成绩从高到低排序
入参:无
返回值:无
*****************************/
void sort_form()
{
for(i=1;i<n;i++)
{
for(j=i+1;j<=n;j++)
if(stu[i].total<stu[j].total)
{
stu[0]=stu[i];
stu[i]=stu[j]; /*交换结构体数组元素stu[i]和stu[j]*/
stu[j]=stu[0];

m=stu[i].rank;
stu[i].rank=stu[j].rank; /*交换第i个和第j个学生的名次*/
stu[j].rank=m;
}
}
}

/*****************************
功能:打印成绩单,
入参:无
返回值:无
*****************************/
void print_form()
{
printf(TABLE_HEAD);
for(i=1;i<=n;i++)
printf("%5d%5d%5d%5d%5d%5d %3.1f\n",DATA);
}
/*****************************
功能:以学号为索引查找某位同学的所有信息
入参:无
返回值:无
*****************************/
void search_one()
{
printf("please input the NO. of the student you want to search: ");
scanf("%d",&k);
printf(TABLE_HEAD);
while (k)
{
for(i=1;i<=n;i++)
if(stu[i].num==k)
printf("%5d%5d%5d%5d%5d%5d %3.1f\n",DATA);
printf("please input the NO. of the student you want to search: ");
scanf("%d",&k);
printf(TABLE_HEAD);
}
}

另外一个
/***********************************************************************
* copyright (c) 2007
* 作者 :
* 日期 : Nov,17th,2007
* 功能 : 本程序实现了以下功能:
1.计算每个学生的总分和平均分
2.按总分成绩有高到低排出成绩的名次
3.打印出名次表,表格内包括学生编号、各科分数、总分和平均分。
4.任意输入一个学号,能够查找出该学生在班级中的排名及其考试分数。
************************************************************************/
#include "time.h"
#include "stdio.h"
#include "stdlib.h"

int stu[30][7];
float ave[30]; /*定义全局变量,*/
int i,j,n,m,k;

/*****************************
功能:由随机数产生学生成绩表
入参:无
返回值:无
*****************************/
void input_score()
{
srand(time(NULL));
printf("Please input the number of the students: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
stu[i][1]=i; /*排名赋初值*/
stu[i][6]=i; /*学号*/
for(j=2;j<=4;j++)
stu[i][j]=rand()%40+60;
}
}

/*****************************
功能:计算每位同学的总分和平均分
并保存在数组中
入参:无
返回值:无
*****************************/
void tol_ave()
{
for(i=1;i<=n;i++)
{
stu[i][5]=stu[i][2]+stu[i][3]+stu[i][4];
ave[i]=stu[i][5]/3;
}
}
/*****************************
功能:根据成绩表对学生成绩从高到低排序
入参:无
返回值:无
*****************************/

void sort_form()
{
for (i=1;i<n;i++)
for (j=i+1;j<=n;j++)
if (stu[i][5]<stu[j][5])
{
for (m=2;m<=6;m++)
{
k=stu[i][m];
stu[i][m]=stu[j][m];
stu[j][m]=k;
}
}
}
/*****************************
功能:打印成绩单,
入参:无
返回值:无
*****************************/
void print_form()
{ /*Rank 为排名,total为总分,ave为平均分,NO.为学号*/
printf("Rank Math Eng Phy Total NO. Ave\n");
for(i=1;i<=n;i++)
{
for(j=1;j<=6;j++)
printf(" %-4d",stu[i][j]);
printf("%3.1f\n",ave[i]);
}
}
/*****************************
功能:以学号为索引查找某位同学的所有信息
入参:无
返回值:无
*****************************/
void search_one()
{

printf("Please input the NO. of the student you want,then press 'Enter' NO:");
scanf("%d",&k);
puts("\nRank Math Eng Phy Total NO. Ave");
while(k)
{
for(i=1;i<=n;i++)
if(stu[i][6]==k)
{
for(j=1;j<=6;j++)
printf(" %-4d",stu[i][j]);
printf("%3.1f\n\n",ave[i]);
}
printf("Please input the NO. of the student you want,then press 'Enter' NO:");
scanf("%d",&k);
puts("\nRank Math Eng Phy Total NO. Ave");
}
}

main()
{
input_score(); /*产生成绩表*/
tol_ave(); /*求总分和平均分*/
sort_form(); /*按总分排名次*/
print_form(); /*打印成绩表*/
search_one(); /*查找某位学生成绩*/
}

第三个
/**************************************
* copyright (c) 2007
* 作者 :
* 日期 : Nov,8th,2007
* 功能 : 本程序实现了利用“子函数”打印
奇数列或偶数列空三角的功能。
**************************************/

#include"stdio.h"
void print_even(int i,int n) /*列为偶数时,打印图案中的第i行*/
{
int k;
for(k=1;k<=(n/2-i+1);k++)
printf("*");
for(k=1;k<=(2*i-2);k++)
printf(" ");
for(k=1;k<=(n/2-i+1);k++)
printf("*");
printf("\n");
}

void print_odd(int i,int n) /*列为奇数时,打印图案中的第i行*/
{
int k;
for(k=1;k<=(n-1)/2-i+2;k++)
printf("*");
for(k=1;k<=2*i-3;k++)
printf(" ");
for(k=1;k<=(n-1)/2-i+2;k++)
printf("*");
printf("\n");
}

main()
{
int row,column,k;
printf("Please input the column\n");
scanf("%d",&column);
if(!(column%2)) /*当列为偶数时*/
{
for(row=1;row<=column/2;row++)
print_even(row,column); /*调用函数print_even打印第row行*/
}
else /*当列为奇数时*/
{
for(k=1;k<=column;k++)
printf("*"); /*打印图案的第一行*/
printf("\n");
for (row=2;row<=(column+1)/2;row++)
print_odd(row,column); /*调用函数print_odd打印其它行*/
}
getch();
}

第四个
/* 学生信息结构体数组练习 */
#include "stdio.h"
struct student{
long int num;
char name[20];
char sex;
char age;
float math;
float english;
float c_prog;
float computer;
float average;
};
main()
{
void Print_Name_List(struct student *p,int n);
void Average(struct student *p,int n);
void Print_Average(struct student *p,int n);
void Sort(struct student *p,int n);
struct student s[31]={{714101,"Wang li",'M',21,87.0,65.5,98.0,78.5,0.0},
{714102,"Zhang lin",'M',22,77.0,55.5,88.0,74.5,0.0},
{714103,"Wang haifeng",'M',21,67.0,65.5,68.0,72.5,0.0},
{714104,"Tang siling",'F',20,81.0,75.5,78.0,88.5,0.0},
{714105,"Yang hua",'M',22,82.0,76.5,58.0,75.5,0.0},
{714106,"Zan dechen",'M',22,77.0,85.5,68.0,72.5,0.0},
{714107,"Wang yin",'F',20,77.0,23.5,72.0,67.5,0.0},
{714108,"ZHang kaiyue",'M',19,57.0,75.5,68.0,63.5,0.0},
{714109,"Han Dongmei",'F',23,81.0,63.5,78.0,71.5,0.0},
{714110,"Yue juan",'F',22,64.0,69.5,63.0,68.5,0.0},
{714111,"Liu feng",'F',21,72.0,75.5,78.0,71.5,0.0},
{714112,"Xia hui",'M',21,70.0,60.5,78.0,63.5,0.0},
{714113,"Chen hao",'F',22,72.0,64.5,88.0,48.5,0.0},
{714114,"Yu zhenyang",'M',21,77.0,75.5,68.0,58.5,0.0},
{714115,"Ye juzheng",'F',23,87.0,69.5,65.0,71.5,0.0},
{714116,"Hong ye",'F',20,82.0,62.5,92.0,71.5,0.0},
{714117,"Guo weihua",'M',21,87.0,65.5,98.0,78.5,0.0},
{714118,"Jin shengjun",'F',21,80.0,61.5,91.0,71.5,0.0},
{714119,"Zhao long",'F',21,85.0,75.5,96.0,78.5,0.0},
{714120,"Xu dafei",'F',22,82.0,85.5,68.0,79.5,0.0},
{714121,"Ma sanle",'M',21,80.0,61.5,90.0,72.5,0.0},
{714122,"Zhu xia",'M',22,81.0,60.5,59.0,68.5,0.0},
{714123,"Tian yingxin",'F',21,81.0,66.0,90.5,79.5,0.0},
{714124,"Gao fei",'M',23,83.0,75.5,83.0,85.5,0.0}};
Print_Name_List(s,24);
getch();
Average(s,24);
Print_Average(s,24);
getch();
Sort(s,24);
Print_Average(s,24);
getch();
}

void Print_Name_List(struct student *p,int n)
{
int i;
for(i=0;i<n;i++)
printf("%6ld: %-15s %c %4d %5.1f%5.1f%5.1f%5.1f\n",
p[i].num,p[i].name,p[i].sex,p[i].age,
p[i].math,p[i].english,p[i].c_prog,p[i].computer);
}

void Average(struct student *p,int n)
{
int i;
for(i=0;i<n;i++)
p[i].average=(p[i].math+p[i].english+p[i].c_prog+p[i].computer)/4;
}
void Print_Average(struct student *p,int n)
{
int i;
for(i=0;i<n;i++)
printf("%6ld: %-15s %c %4d %5.1f%5.1f%5.1f%5.1f%5.1f\n",
p[i].num,p[i].name,p[i].sex,p[i].age,
p[i].math,p[i].english,p[i].c_prog,p[i].computer,p[i].average);
}

void Sort(struct student *p,int n)
{
int i,j,k;
struct student w;
for(i=0;i<n-1;i++)
{ k=i;
for(j=i+1;j<n;j++)
if(p[k].average<p[j].average) k=j;
w=p[i];
p[i]=p[k];
p[k]=w;
}
}
zj519697032
2009-06-10 · TA获得超过281个赞
知道小有建树答主
回答量:215
采纳率:100%
帮助的人:52.4万
展开全部
真值表

#include<stdio.h>

typedef char DataType;

typedef struct Node
{
DataType data;
struct Node *leftchild;
struct Node *rightchild;
} BiTreeNode;

BiTreeNode *create()
{
char ch;
BiTreeNode *bt;
scanf("%c",&ch);
if(ch=='#')
return NULL;
bt=(BiTreeNode*)malloc(sizeof(BiTreeNode));
bt->data=ch;
bt->leftchild=create();
bt->rightchild=create();
return bt;
}

void Inorder(BiTreeNode *t)
{
if(t!=NULL)
{
Inorder(t->leftchild);
printf("%c",t->data);
Inorder(t->rightchild);
}
}

void Destroy(BiTreeNode **root)
{
if((*root)!=NULL&&(*root)->leftchild!=NULL)
Destroy(&(*root)->leftchild);
if((*root)!=NULL&&(*root)->rightchild!=NULL)
Destroy(&(*root)->rightchild);
free(*root);
}

void TruthtableA(int z)
{
int p,x;
for(p=0;p<=1;p++)
{
printf("%d ",p);

if(z==1)
{
if(!p)
{
x=1;
printf("%d ",x);
}
else
{
x=0;
printf("%d ",x);
}

printf("\n");
}
}
}

void TruthtableB(int z)
{
int p,q,x;
for(p=0;p<=1;p++)
for(q=0;q<=1;q++)
{
printf("%d %d ",p,q);

if(z==2)
{
if(p&&q)
{
x=1;
printf("%d ",x);
}
else
{
x=0;
printf("%d ",x);
}
}

if(z==3)
{
if(p||q)
{
x=1;
printf("%d ",x);
}
else
{
x=0;
printf("%d ",x);
}
}
printf("\n");
}
}

void TruthtableC(int z)
{
int p,q,r,x;
for(p=0;p<=1;p++)
for(q=0;q<=1;q++)
for(r=0;r<=1;r++)
{
printf("%d %d %d ",p,q,r);

if(z==4)
{
if(!(p&&q)||r)
{
x=1;
printf("%d ",x);
}
else
{
x=0;
printf("%d ",x);
}
}

if(z==5)
{
if(!(p||q)||r)
{
x=1;
printf("%d ",x);
}
else
{
x=0;
printf("%d ",x);
}
}

if(z==6)
{
if(!p||(!q||r))
{
x=1;
printf("%d ",x);
}
else
{
x=0;
printf("%d ",x);
}
}

if(z==7)
{
if(!(!p||q)||r)
{
x=1;
printf("%d ",x);
}
else
{
x=0;
printf("%d ",x);
}
}

printf("\n");

}
}

void main(void)
{
BiTreeNode *root;
int p,q,r,z,i;
clrscr();
printf(" ~p--1\n p^q--2\n pvq--3\n (p^q)->r--4\n (pvq)->r--5\n p->(q->)--6\n (p->q)->r--7\n");
printf("Please create a Binary tree!\n");
root=create();
printf("Please put in the number of Binary tree!\n");
scanf("%d",&z);
clrscr();
if(z==1)
{
printf("p ");
Inorder(root);
printf("\n");
TruthtableA(z);
}

else if(z>1&&z<=3)
{
printf("p q ");
Inorder(root);
printf("\n");
TruthtableB(z);
}

else if(z>3&&z<=7)
{
printf("p q r ");
Inorder(root);
printf("\n");
TruthtableC(z);
}

else

printf("z is error!");

Destroy(&root);

getch();
}

已赞过 已踩过<
你对这个回答的评价是?
评论 收起
十米若狂忆15
2009-06-10 · TA获得超过138个赞
知道答主
回答量:190
采纳率:100%
帮助的人:79.3万
展开全部
财产管理:
#include <stdio.h>
#include <malloc.h>
typedef struct setup
{
char order[5];
float length;
float width;
float height;
struct setup *front,*after;
}desk1,*desk2;
desk2 desk_indicator=NULL;
desk2 create_node(int count_fou)
{
int i,count_ten=count_fou;
desk2 provisional1=NULL,provisional2=NULL,provisional3=NULL;
for(i=1;i<=count_ten;i++)
{
provisional1=(desk2)malloc(sizeof(desk1));
if(i==0)
{
provisional3=provisional1;
printf("%-8d请输入桌椅序号,长,宽,高\n",i);
scanf("%s%f%f%f",&provisional1->order,&provisional1->length,&provisional1->width,&provisional1->height);
provisional1->after=NULL;
provisional1->front=NULL;
provisional2=provisional1;
}
if((i!=0)&&(i!=count_ten))
{
provisional1->after=provisional2;
provisional2->front=provisional1;
provisional1->front=NULL;
printf("%-8d请输入桌椅序号,长,宽,高\n",i);
scanf("%s%f%f%f",&provisional1->order,&provisional1->length,&provisional1->width,&provisional1->height);
provisional2=provisional1;
}
if(i==count_ten)
{
provisional1->front=desk_indicator;
desk_indicator->after=provisional1;
provisional1->after=provisional2;
provisional2->front=provisional1;
printf("%-8d请输入桌椅序号,长,宽,高\n",i);
scanf("%s%f%f%f",&provisional1->order,&provisional1->length,&provisional1->width,&provisional1->height);
}
}
free(provisional1);
free(provisional2);
printf("\n\n");
return provisional3;
}
int insert_node()
{
int count_node;
desk2 provisional=search_node();
desk2 indicator_return=NULL;
if(provisional==NULL)
{
printf("\n\n\t\t\t\t没有找到!\n\n");
free(provisional);
free(indicator_return);
return 0;
}
else
{
printf("\n结点的数量\t\t");
scanf("%d",&count_node);
indicator_return=create_node(count_node);
provisional->front=indicator_return;
indicator_return->after=provisional;
provisional->front->after=indicator_return->after;
indicator_return->after->front=provisional->front;
free(provisional);
free(indicator_return);
return 1;
}
}
void delete_node()
{
desk2 provisional1=NULL;
desk2 provisional2=NULL;
provisional1=search_node();
if(provisional1==NULL)
{
free(provisional1);
free(provisional2);
printf("\n\n\t\t\t\t没有找到!\n\n");
}
else if(provisional1==desk_indicator)
{
desk_indicator->front->after=desk_indicator->after;
desk_indicator->after->front=desk_indicator->front;
desk_indicator=desk_indicator->front;
free(provisional1);
free(provisional2);
}
else if(provisional1=desk_indicator->after)
{
provisional2=desk_indicator->after->after;
provisional2->front=desk_indicator;
desk_indicator->after=provisional2;
free(provisional1);
free(provisional2);
}
else
{
provisional1->front->after=provisional1->after;
provisional1->after->front=provisional1->front;
free(provisional1);
free(provisional2);
}
}
void display_node()
{
desk2 provisional=desk_indicator;
printf("\n\n--------------------------------------------------------------------------------\n");
printf("%-10s%-8.2f%-8.2f%-8.2f\n","编号","长","宽","高");
printf("%-10s%-8.2f%-8.2f%-8.2f\n",provisional->order,provisional->length,provisional->width,provisional->height);
provisional=provisional->front;
while(provisional!=desk_indicator)
{
printf("%-10s%-8.2f%-8.2f%-8.2f\n","编号","长","宽","高");
printf("%-10s%-8.2f%-8.2f%-8.2f\n",provisional->order,provisional->length,provisional->width,provisional->height);
provisional=provisional->front;
}
printf("--------------------------------------------------------------------------------\n\n\n");
free(provisional);
}
desk2 search_node()
{
char desk_assign[5];
desk2 provisional1=desk_indicator;
printf("\n请输入桌椅编号\t\t");
scanf("%s",&desk_assign);
if(!strcmp(provisional1->order,desk_assign))
return provisional1;
else
provisional1=provisional1->front;
while(provisional1!=desk_indicator)
{
if(!strcmp(provisional1->order,desk_assign))
return provisional1;
else
provisional1=provisional1->front;
}
return NULL;
}
void menu_display()
{
printf("\n\n--------------------------------------------------------------------------------\n");
printf("\n\t\t0:退出\t\t\t1:创建\n\t\t2:查看\t\t\t3:插入\n\t\t4:查找\t\t\t5:删除\n");
printf("--------------------------------------------------------------------------------\n");
}
void main()
{
int exit_sign=1,chose_sign=0,count_node=0;
menu_display();
while(exit_sign)
{
scanf("%d",&chose_sign);
switch(chose_sign)
{
case 1:
{
printf("\n请输入结点的数量\t\t");
scanf("%d",&count_node);
desk_indicator=create_node(count_node);
break;
}
case 2:
{
if(desk_indicator==NULL)
printf("\n必须首先创建\n\n");
else
menu_display();
display_node();
break;
}
case 3:
{
if(desk_indicator==NULL)
printf("\n必须首先创建\n\n");
else
insert_node();
break;
}
case 4:
{
if(desk_indicator==NULL)
printf("\n必须首先创建\n\n");
else
search_node();
break;
}
case 5:
{
if(desk_indicator==NULL)
printf("\n必须首先创建\n\n");
else
delete_node();
break;
}
default:break;
}
scanf("%d",&exit_sign);
}
}
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式