有关数组、true、返回上一步以及用户编配信息。
我这个程序是自己写的,菜鸟一个,主要是为了实现用户可以随意组合马匹和人员,并且打印出在屏幕上,存在缓存中,下一步(目前还没有编写)对这个用户编配的马匹和人员进行随机事件(利用随机数) 希望诸位大虾们不要改动太多, 请大侠们帮我看看 我在数组的使用中哪儿出现了错误 还有有关 true的使用方法。。 我这是整个的一个程序 自己做好累啊。。。。太菜了 衷心的感谢大虾们帮助我 谢谢。#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
main ()
{
int z,a,true;
int e[16]={{"No1"},{"No2"},{"No3"},{"No4"},{"No5"},{"No6"},{"No7"},{"No8"},{"No9"},{"No10"},{"No11"},{"No12"},{"No13"},{"No14"},{"No15"},{"No16"}};
char i,mapi,renyuan;
printf("welcome to this horse math \n");
L:
clrscr();
gotoxy(1,1);
printf("qing xuanze yige cai dan jinru\n");
printf("start math -----s\n");
printf(" equipage -----e\n");
printf(" exit -----x\n");
scanf("%c", &i);
getchar();
if (i=='x'){return 0;}
if (i=='e'){ clrscr();
gotoxy(1,1);
printf("one===chitu\ntwo===jueying\nthree===feidian\nfour===dilu\n");
printf("q===liubei\nw===lvbu\ne===zhangzhao\nr===caocao\n");
printf(" return----f\n");
printf(" exit -----x\n");
scanf("%c",&i);
getchar();
if(i=='x'){return 0;}
if(i=='f'){ goto L ;}
}
if (i=='s')
{
clrscr();
gotoxy(1,1);
printf("mapiyou\none----o\ntwo----t\nthree----e\nfour----f\n");
printf("renyuanyou\nq\nw\ne\nr\n");
P:
printf("qingshurumapi\n");
scanf("%c", &mapi);
getchar();
if (mapi=='o')
{
printf("nixuanzedeshi %c\nqingjiexialaixuanzeren" ,mapi);
scanf("%c",&renyuan);
getchar();
if (renyuan=='q')
{printf("one and q name is No.1 equipage\n");e[1]=true;}
if (renyuan=='w')
{printf("one and w name is No.2 equipage\n");e[2]=true;}
if (renyuan=='e')
{printf("one and e name is No.3 equipage\n");e[3]=true;}
if (renyuan=='r')
{printf("one and r name is No.4 equipage\n");e[4]=true;}
}
if (mapi=='t')
{
printf("ni xuanzede shi %c \nqingjiexialaixuanzeren" ,mapi);
scanf("%c",&renyuan);
getchar();
if (renyuan=='q')
{printf("two and q name is No.5 equipage\n");e[5]=true;}
if (renyuan=='w')
{printf("two and w name is No.6 equipage\n");e[6]=true;}
if (renyuan=='e')
{printf("two and e name is No.7 equipage\n");e[7]=true;}
if (renyuan=='r')
{printf("two and r name is No.8 equipage\n");e[8]=true;}
}
if (mapi=='e')
{
printf("ni xuanzede shi %c \nqingjiexialaixuanzeren" ,mapi);
scanf("%c",&renyuan);
getchar();
if (renyuan=='q')
{printf("three and q name is No.9 equipage\n");e[9]=true;}
if (renyuan=='w')
{printf("three and w name is No.10 equipage\n");e[10]=true;}
if (renyuan=='e')
{printf("three and e name is No.11 equipage\n");e[11]=true;}
if (renyuan=='r')
{printf("three and r name is No.12 equipage\n");e[12]=true;}
}
if (mapi=='f')
{
printf("ni xuanzede shi %c \nqingjiexialaixuanzeren" ,mapi);
scanf("%c",&renyuan);
getchar();
if (renyuan=='q')
{printf("four and q name is No.13 equipage\n");e[13]=true;}
if (renyuan=='w')
{printf("four and w name is No.14 equipage\n");e[14]=true;}
if (renyuan=='e')
{printf("four and e name is No.15 equipage\n");e[15]=true;}
if (renyuan=='r')
{printf("four and r name is No.16 equipage\n");e[16]=true;}
for(a=-1;a<16;a++)
{
printf("cansaiedduiwuyou%s",e[a]);
}
}}
getch();
}