
#include <stdioh>
#include <stringh>
#define NUM1 20
#define NUM2 20
#define NUM3 10
#define N 4
int num=0;
typedef struct student{
int n;
float score;
struct student next;
}student;
void newstring()
{
char s[NUM1]="abcdefg";
char t[NUM1]="ackblm";
char u[NUM1]="";
int i=0,j=0,m=0;
for(i=0;s[i]!=0;i++)
{
for(j=0;t[j]!=0;j++)
{
if(s[i]==t[j])
{
for(m=0;u[m]!=0;m++)
{
if(u[m]==t[j]) break;
}
if(u[m]==0)
{
u[m]=t[j];
break;
}
}
}
}
printf("%s\n",u);
}
void fun()
{
char s[NUM2]="ABCD";
char t[NUM2]="";
int len=strlen(s),i,j;
printf("%d\n",len);
strcpy(t,s);
for(i=0,j=len-1;i<len;i++,j--)
{
t[len+i]=s[j];
}
printf("%s\n",t);
}
void bear()
{
int num=1,i;
for(i=NUM3-1;i>0;i--)
{
num=num2+1;
}
printf("The result is %d\n",num);
}
void studentgoal()
{
int i=0;
float score=0;
student stu[N],p;
stu[3]n=0;
stu[3]score=96;
stu[3]next=0;
stu[2]n=2;
stu[2]score=94;
stu[2]next=&stu[3];
stu[1]n=1;
stu[1]score=92;
stu[1]next=&stu[2];
stu[0]n=0;
stu[0]score=90;
stu[0]next=&stu[1];
p=stu;
while(i<N)
{
score=score+p->score;
p=p->next;
i++;
}
score=score/40;
printf("score=%f\n",score);
}
void goodbye()
{
printf("Good bye!\n");
}
void main()
{
char input,start='Y';
while(start=='Y' || start=='y')
{
printf("Menu:\t1:New String\n\t2:Connecting String\n\t3:Bear eats nuts\n\t4:Students' average score\n\t5: exit()\nPlease input the select num:");
scanf("%c",&input);
getchar();
switch(input)
{
case '1': newstring();break;
case '2': fun();break;
case '3': bear();break;
case '4': studentgoal();break;
case '5': goodbye();exit();
default: printf("Your input is wrong! ");
}
printf("Do you want to continue(Y/N)");
scanf("%c",&start);
getchar();
}
}
给你例子吧,自己研究
int Menu_popu(int x1,int y1,int x2,int y2,P_U8 MainMenu,int count,int Menucount,int linex1,int liney1,int linex2,int liney2)//被调函数
{
int i,j,choice,displayfir,Maxkey;
uchar k;
screen(1);
choice=0;displayfir=0;Maxkey=Menucount+48;
do
{
clsn(x1,x2-x1+1);
drawrect(linex1,liney1,linex2,liney2);
j=0;
for(i=displayfir;i<displayfir+count && i<Menucount;i++,j++)
{
moveto(x1+2j,y1);
if(i==choice){putstr_x(MainMenu[i],1);}
else{putstr(MainMenu[i]);}
}//for
k=key(0);
if(k==KEY_ENTER){if(choice==Menucount-1)return MSG_ESC;else return choice;}
else if(k==KEY_F2){return MSG_ESC;}
else if(k==KEY_DOWN){choice++; if(choice==Menucount) {choice--;}
if((choice%count)==0) {displayfir=choice;}
}
else if(k==KEY_UP){choice--; if(choice<0) {choice=0;}
if(((choice+1)%count)==0) {displayfir=choice+1-count;}
}
else if(0x30<k&&k<=(Maxkey-displayfir-1)){return (k-0x31);}
}while(1);
}
void MainMenu(void)//主调函数
{
uchar s[12];
int i;
while (1)
{ //进入功能菜单选择
cls();moveto(19,18);putstr(" ");
memset(s,0,sizeof(s));
getdate(s);moveto(19,2); putstr("日期: "); putn_h(10,s);
i=Menu_popu(1,3,18,20,Menu,8,8,10,10,135,135);
if(i==0)SUB_ADD();//补抄
else if(i==1)SUB_APPEND();//续抄
else if(i==2)SUB_CB();//抄表
else if(i==3)SUB_ABNORMAL();//异常
else if(i==4)SUB_CHECK();//查询
else if(i==5)SUB_SUM();//统计
else if(i==MSG_ESC){libclose(0);return;}//退出
}
}
以上就是关于C语言做一个小系统,先设计一个菜单程序,再具体写出。全部的内容,包括:C语言做一个小系统,先设计一个菜单程序,再具体写出。、求!设计一个菜单程序,列出所作设计的全部功能,运行时可以通过选择菜单,调用相应函数实现功能,输出结果、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)