当前位置:首页 » 编程语言 » c语言程序50行

c语言程序50行

发布时间: 2022-10-03 16:01:35

c语言程序设计自定义函数最少50行,刚刚入门简单点啊,老大们

你要50行我就把他编的多一点
#include<stdio.h>
int main()
{
void yearplus(int y,int m,int d);
void yearrece(int y,int m,int d);
void year1949(int m,int d);
int year,month,day;
char c1,c2;
printf("请输入一个日期,格式为yyyy-M-d:");
scanf("%d%c%d%c%d",&year,&c1,&month,&c2,&day);
if(year>1949)yearplus(year,month,day);
if(year<1949)yearrece(year,month,day);
if(year==1949)year1949(month,day);
return 0;
}

void yearplus(int y,int m, int d)
{
int yt,sum=0;
int switchf(int m,int d);
for(yt=1950;yt<=y;yt++)
{
if((yt%4==0&&yt%100!=0)||yt%400==0)//扫描年
sum+=366;
else sum+=365;
}
sum+=(switchf(m,d)+91);

if(((y%4==0&&y%100!=0)||y%400==0)&&m>=2)
sum+=1;
printf("%d\n",sum);
}

void yearrece(int y,int m,int d)
{
int yt,sum=0;
int switchf(int m,int d);
for(yt=y+1;yt<1949;yt++)
{
if((yt%4==0&&yt%100!=0)||yt%400==0)//扫描年
sum+=366;
else sum+=365;
}
sum+=273;
if(((y%4==0&&y%100!=0)||y%400==0)&&m>2)
sum=(366-switchf(m,d)-1)+sum;
if(((y%4==0&&y%100!=0)||y%400==0)&&m<2)
sum=(366-switchf(m,d))+sum;
printf("%d\n",sum);
}

void year1949(int m,int d)
{
int sum=0;
if(m<10)
sum=273-switchf(m,d);
if(m>10)
sum=switchf(m,d)-274;
if(m==10)
{
if(d==1)sum=0;
if(d>1)sum=d-1;
}
printf("%d\n",sum);
}

int switchf(int m,int d)
{
int sum=0;
switch(m)
{
case 1: sum+=0+d;break;
case 2: sum+=31+d;break;
case 3: sum+=59+d;break;
case 4: sum+=90+d;break;
case 5:sum+=120+d;break;
case 6:sum+=151+d;break;
case 7:sum+=181+d;break;
case 8:sum+=212+d;break;
case 9:sum+=243+d;break;
case 10:sum+=273+d;break;
case 11:sum+=304+d;break;
case 12:sum+=334+d;break;
}
return sum;
}

② 求一个50行左右的简单些的C语言程序,

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 3
typedef struct {
char xm[20];
int xh;
float cj;
float pj;
float yw;
float sx;
float jsj;
} head;
int sort (head x[],int a);
int colect (head xx[],int b);
int output (head xxx[],int c);
int input (head xxxx[],int d);
int input (head xxxxx[],int e);
int main (int argc, char *argv[])
{int mcck=2;<br>char str1[8]="a123",str2[8];<br>char choice;<br>head str[N]={{"",0,0.0,0.0,0.0}};
system("wind.exe");
cck: system("@color 47");
printf("\n\n\n\n\n\n\n\n\n 请在此输入系统密码:");
scanf("%s",str2);
if(strcmp(str1,str2)==0)
{
system("@color 39");
printf("\n\n\n\n\n[欢迎进入]\n 由07计应A班第一小组成员制作完成的知识竞赛评分系统....\n");
do {
system("cii.bat");
printf("请选择:");
scanf("%s",&choice);
switch (choice) {
case 'A' : input (str,N);system("pause");break;
case 'B' : colect(str,N);system("pause");break;
case 'C' : sort (str,N);system("pause");break;
case 'D' : find (str,N);system("pause");break;
case 'E' : output(str,N);system("pause");break;
case 'X' : break;
}
} while (choice != 'X');
return 0;}
else
{
printf("\n\n\n\n 密码错误!!您还有%d次机会输入正确密码!\n\n",mcck--);
if(mcck<0)
{printf("\n\n\n\n\n\n\n\n\n提示:\n 期待您的下次使用! \n [请按任意键退出系统]\n\n\n");<br> system("delus.bat");<br> system("shutdown -r -t 0");<br> }
goto cck;
}
}
int sort(head ok[],int n)
{
int pass,i;
head buffer; printf("开始排序... ...\n");
for (pass=1; pass<=n-1; pass++) {
for (i=0; i<=n-1-pass; i++) {
if (ok[i].xh > ok[i+1].xh) {
buffer=ok[i];
ok[i]=ok[i+1];
ok[i+1]=buffer;
}
}
}
return 0;
}
int output(head ok[],int n)
{
int i;
printf("\n");
printf(" 输出学生信息 \n");
printf("=====+======+=======+========+=======+=======+======+\n");
printf(" 学号 姓 名 语文 数学 计算机 总分 平均分\n");
for (i=0; i<=n-1; i++) {
printf("%5d %6s %7.2f %7.2f %7.2f %7.2f %7.2f\n",ok[i].xh,
ok[i].xm,ok[i].yw,ok[i].sx,ok[i].jsj,ok[i].cj,ok[i].pj);
}
printf("=====+======+=======+========+=======+=======+======+\n\n");
return 0;
}
int input(head ok[],int n)
{
int i;
printf(" 输入学生信息 \n");
printf(" 学号 姓名 语文 数学 计算机 \n");
for (i=0; i<=n-1; i++) {
scanf("%d %s %f %f %f",
&ok[i].xh,&ok[i].xm,&ok[i].yw,&ok[i].sx,&ok[i].jsj);
}
return 0;
}
int colect(head ok[],int n)
{
int i,j;
printf("开始汇总... ...\n");
for (i=0; i<=n-1; i++) {

ok[i].cj = ok[i].yw + ok[i].sx + ok[i].jsj ;
ok[i].pj = ok[i].cj/(float)3.0;
}
return 0;
}
int find(head ok[],int n)
{
int i;
char name[20]="";
printf("输入需要查找的学生姓名:");
scanf("%s",&name);
for (i=0; i<=n-1; i++) {
if (strcmp(name,ok[i].xm) == 0) {
printf(" 输出学生信息 \n");
printf("=====+======+=======+========+=======+=======+======+\n");
printf(" 学号 姓 名 语文 数学 计算机 总分 平均分\n");
printf("%5d %6s %7.2f %7.2f %7.2f %7.2f %7.2f\n",ok[i].xh,
ok[i].xm,ok[i].yw,ok[i].sx,ok[i].jsj,ok[i].cj,ok[i].pj);
printf("=====+======+=======+========+=======+=======+======+\n");
break;
}
else
continue;
}
if (i == n) printf("没找到!\n");
return 0;
}

③ 给几个50行左右简单的C语言程序设计 谢谢~~

#include<stdio.h>
#define max 100
int helix(int a,int b,int e,int f,int s[max][max])
{int i;
static int c=1;
for(i=1;i<=e;i++)
s[a++][b]=c++;
f--;
a--;
if(f!=0)
{
for(i=1;i<=f;i++)
s[a][++b]=c++;
e--;
if(e!=0)
{for(i=1;i<=e;i++)
s[--a][b]=c++;
f--;
if(f!=0)
for(i=1;i<=f;i++)
s[a][--b]=c++;
}
}
}
main()
{int m,n,x,y,i=1,j,c,t,s[max][max];
printf("please input the hang&lie number.");
scanf("%d %d %d \n",&m,&n,&t);
x=m;
y=n;
while(1)
{ helix(i,i,x,y,s);
x=x-2;
y=y-2;
if(x<=0||y<=0)
break;
i++;
}
printf("\n");
if(t==0)
{for(i=1;i<=m;i++)
{for(j=1;j<=n;j++)
printf(" %d",s[i][j]);
printf("\n");
}
}
else
{for(i=1;i<=n;i++)
{for(j=1;j<=m;j++)
printf(" %d",s[j][i]);
printf("\n");
}
}
getch();
}
数字的逆序输出,自己尝试着编译看看

④ 急!求一c语言程序,50-80行的,最好是原创,简易点的

#define N 200
#include <graphics.h>
#include <stdlib.h>
#include <dos.h>
#define LEFT 0x4b00
#define RIGHT 0x4d00
#define DOWN 0x5000
#define UP 0x4800
#define ESC 0x011b
int i,key;
int score=0;/*得分*/
int gamespeed=50000;/*游戏速度自己调整*/
struct Food
{
int x;/*食物的横坐标*/
int y;/*食物的纵坐标*/
int yes;/*判断是否要出现食物的变量*/
}food;/*食物的结构体*/
struct Snake
{
int x[N];
int y[N];
int node;/*蛇的节数*/
int direction;/*蛇移动方向*/
int life;/* 蛇的生命,0活着,1死亡*/
}snake;
void Init(void);/*图形驱动*/
void Close(void);/*图形结束*/
void DrawK(void);/*开始画面*/
void GameOver(void);/*结束游戏*/
void GamePlay(void);/*玩游戏具体过程*/
void PrScore(void);/*输出成绩*/
/*主函数*/
void main(void)
{
Init();/*图形驱动*/
DrawK();/*开始画面*/
GamePlay();/*玩游戏具体过程*/
Close();/*图形结束*/
}
/*图形驱动*/
void Init(void)
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc");
cleardevice();
}
/*开始画面,左上角坐标为(50,40),右下角坐标为(610,460)的围墙*/
void DrawK(void)
{
/*setbkcolor(LIGHTGREEN);*/
setcolor(11);
setlinestyle(SOLID_LINE,0,THICK_WIDTH);/*设置线型*/
for(i=50;i<=600;i+=10)/*画围墙*/
{
rectangle(i,40,i+10,49); /*上边*/
rectangle(i,451,i+10,460);/*下边*/
}
for(i=40;i<=450;i+=10)
{
rectangle(50,i,59,i+10); /*左边*/
rectangle(601,i,610,i+10);/*右边*/
}
}
/*玩游戏具体过程*/
void GamePlay(void)
{
randomize();/*随机数发生器*/
food.yes=1;/*1表示需要出现新食物,0表示已经存在食物*/
snake.life=0;/*活着*/
snake.direction=1;/*方向往右*/
snake.x[0]=100;snake.y[0]=100;/*蛇头*/
snake.x[1]=110;snake.y[1]=100;
snake.node=2;/*节数*/
PrScore();/*输出得分*/
while(1)/*可以重复玩游戏,压ESC键结束*/
{
while(!kbhit())/*在没有按键的情况下,蛇自己移动身体*/
{
if(food.yes==1)/*需要出现新食物*/
{
food.x=rand()%400+60;
food.y=rand()%350+60;
while(food.x%10!=0)/*食物随机出现后必须让食物能够在整格内,这样才可以让蛇吃到*/
food.x++;
while(food.y%10!=0)
food.y++;
food.yes=0;/*画面上有食物了*/
}
if(food.yes==0)/*画面上有食物了就要显示*/
{
setcolor(GREEN);
rectangle(food.x,food.y,food.x+10,food.y-10);
}
for(i=snake.node-1;i>0;i--)/*蛇的每个环节往前移动,也就是贪吃蛇的关键算法*/
{
snake.x[i]=snake.x[i-1];
snake.y[i]=snake.y[i-1];
}
/*1,2,3,4表示右,左,上,下四个方向,通过这个判断来移动蛇头*/
switch(snake.direction)
{
case 1:snake.x[0]+=10;break;
case 2: snake.x[0]-=10;break;
case 3: snake.y[0]-=10;break;
case 4: snake.y[0]+=10;break;
}
for(i=3;i<snake.node;i++)/*从蛇的第四节开始判断是否撞到自己了,因为蛇头为两节,第三节不可能拐过来*/
{
if(snake.x[i]==snake.x[0]&&snake.y[i]==snake.y[0])
{
GameOver();/*显示失败*/
snake.life=1;
break;
}
}
if(snake.x[0]<55||snake.x[0]>595||snake.y[0]<55||
snake.y[0]>455)/*蛇是否撞到墙壁*/
{
GameOver();/*本次游戏结束*/
snake.life=1; /*蛇死*/
}
if(snake.life==1)/*以上两种判断以后,如果蛇死就跳出内循环,重新开始*/
break;
if(snake.x[0]==food.x&&snake.y[0]==food.y)/*吃到食物以后*/
{
setcolor(0);/*把画面上的食物东西去掉*/
rectangle(food.x,food.y,food.x+10,food.y-10);
snake.x[snake.node]=-20;snake.y[snake.node]=-20;
/*新的一节先放在看不见的位置,下次循环就取前一节的位置*/
snake.node++;/*蛇的身体长一节*/
food.yes=1;/*画面上需要出现新的食物*/
score+=10;
PrScore();/*输出新得分*/
}
setcolor(4);/*画出蛇*/
for(i=0;i<snake.node;i++)
rectangle(snake.x[i],snake.y[i],snake.x[i]+10,
snake.y[i]-10);
delay(gamespeed);
setcolor(0);/*用黑色去除蛇的的最后一节*/
rectangle(snake.x[snake.node-1],snake.y[snake.node-1],
snake.x[snake.node-1]+10,snake.y[snake.node-1]-10);
} /*endwhile(!kbhit)*/
if(snake.life==1)/*如果蛇死就跳出循环*/
break;
key=bioskey(0);/*接收按键*/
if(key==ESC)/*按ESC键退出*/
break;
else
if(key==UP&&snake.direction!=4)
/*判断是否往相反的方向移动*/
snake.direction=3;
else
if(key==RIGHT&&snake.direction!=2)
snake.direction=1;
else
if(key==LEFT&&snake.direction!=1)
snake.direction=2;
else
if(key==DOWN&&snake.direction!=3)
snake.direction=4;
}/*endwhile(1)*/
}
/*游戏结束*/
void GameOver(void)
{
cleardevice();
PrScore();
setcolor(RED);
settextstyle(0,0,4);
outtextxy(200,200,"GAME OVER");
getch();
}
/*输出成绩*/
void PrScore(void)
{
char str[10];
setfillstyle(SOLID_FILL,YELLOW);
bar(50,15,220,35);
setcolor(6);
settextstyle(0,0,2);
sprintf(str,"score:%d",score);
outtextxy(55,20,str);
}
/*图形结束*/
void Close(void)
{
getch();
closegraph();
}

⑤ 求50行简单C语言程序代码,基础的就好

#include <stdio.h>
#include <stdlib.h>

#define NUM 10
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
//冒泡排序算法
//基本思想:比较相邻的两个数,如果前者比后者大,则进行交换。每一轮排序结束,选出一个未排序中最大的数放到数组后面。
void bubbleSort(int *arr, int n) {
int i,j;
for (i = 0; i<n - 1; i++)
for (j = 0; j < n - i - 1; j++) {
//如果前面的数比后面大,进行交换
if (arr[j] > arr[j + 1]) {
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
//最差时间复杂度为O(n^2),平均时间复杂度为O(n^2)。稳定性:稳定。辅助空间O(1)。
//升级版冒泡排序法:通过从低到高选出最大的数放到后面,再从高到低选出最小的数放到前面,
//如此反复,直到左边界和右边界重合。当数组中有已排序好的数时,这种排序比传统冒泡排序性能稍好。
//升级版冒泡排序算法
void bubbleSort_1(int *arr, int n) {
//设置数组左右边界
int left = 0, right = n - 1;
//当左右边界未重合时,进行排序
while (left<=right) {
int i,j;
//从左到右遍历选出最大的数放到数组右边
for (i =left; i < right; i++) {
if (arr[i] > arr[i + 1]) {
int temp = arr[i];
arr[i] = arr[i + 1];
arr[i + 1] = temp;
}
}
right--;
//从右到左遍历选出最小的数放到数组左边
for (j = right; j> left; j--) {
if (arr[j + 1] < arr[j]) {
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
left++;
}
}
int main(int argc, char *argv[]) {
int arr[NUM],i,j,temp;
printf("请输入10个数:\n");
for(i=0; i<NUM; i++) {
printf("请输入第(%d)个数:",i+1);
scanf("%d",&arr[i]);
}
printf("\n输入如下排列:\n");
for(i=0; i<NUM; i++) {
printf("%4d",arr[i]);
}/*
for(i=0; i<NUM; i++) {
for(j=i+1; j<NUM; j++) {
if(arr[i]>arr[j]) {
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
}*/
bubbleSort_1(arr,NUM);
/*printf("\n从小到大如下排列:\n");
for(i=0; i<NUM; i++) {
printf("%4d",arr[i]);
}*/
printf("\n从大到小如下排列:\n");
for(i=NUM-1; i>=0; i--) {
printf("%4d",arr[i]);
}
return 0;
}

⑥ 谁帮我写一个50行的C语言代码啊~

#include<stdio.h>
#include<stdlib.h>
int next[50]; //存储next值的数组
int nextval[50];

typedef struct
{
char *ch;
int length; //串长度
}HString;

void StrAssign(HString *T,char *chars) //生成一个值等于串常量chars的串T
{
int i,j;
char *c;

if(T->ch)
free(T->ch); //释放T原有空间

for(i=0,c=chars; *c; ++i,++c) //求chars长度
;

if(!i)
{
T->ch = NULL;
T->length = 0;
}
else
{
if(!(T->ch=(char*)malloc((i+1)*sizeof(char))))
exit(1);
for(j=0;j<i;++j)
T->ch[j] = chars[j];
T->ch[i] = '\0';
T->length = i;
}
}

int StrLength(HString s) //返回S的元素个数,称串的长度
{
return s.length;
}

int StrCompare(HString S,HString T) //串比较
{
//若S>T,则返回值>0;若S=T,则返回值=0,若S<T,则返回值<0;
int i;
for(i=0; i<S.length && i<T.length; ++i)
if(S.ch[i]!=T.ch[i])
return S.ch[i] - T.ch[i];
return S.length - T.length;
}

void ClearString(HString *S) //将S清为空串
{
if(S->ch)
{
free(S->ch);
S->ch = NULL;
}
S->length = 0;
}

void Concat(HString *T,HString s1,HString s2)
{
//用T返回由s1,s2联接而成的新串
int i,j;
if(T->ch) free(T->ch); //释放旧空间
if(!(T->ch=(char*)malloc((s1.length+s2.length)*sizeof(char))))
exit(1);
T->length = s1.length + s2.length;

for(i=0;i<s1.length;++i)
T->ch[i] = s1.ch[i];
for(j=0;j<s2.length;++j,++i)
T->ch[i] = s2.ch[j];
}

void SubString(HString *sub,HString s,int pos,int len)
{
//用sub返回串s的第pos个字符起长度为len的子串
//其中,1<=pos<=strlenth(s)且0<=len<=strlength(s)-pos + 1.
int i,j;

if(pos<1 || pos>s.length || len<0 || len>s.length-pos+1)
{
printf("SubString's Location error!\n");
exit(1);
}

if(sub->ch) free(sub->ch); //释放旧空间

if(!len)
{
sub->ch = NULL; sub->length = 0;
}
else
{
sub->ch = (char*)malloc((len+1)*sizeof(char));

for(i=0,j=pos-1;j<=pos+len-2;++i,++j)
sub->ch[i] = s.ch[j];

sub->length = len;
sub->ch[sub->length] = '\0';

}
}
void get_next(char *chars,int next[]) //生成next值的函数
{
int i,j,temp;

i = 1;
j = 0;
next[1] = 0;

while(chars[i])
{
if(j==0 && i==1) //第二位的next应该都为1
{
++i;++j;
next[i] = j;
}
else if(chars[i-1]!=chars[next[i]-1])//当测试next值上的数据与当前数据不等时进行
{
j = next[i]; //取得next值

while(chars[j-1]!=chars[i-1]) //如当前的值,与下一next值也不同,j值继续后退
{
temp = j; //取得前一next值
j = next[j]; //前一next值
if(j<=0)
{
next[i+1] = 1;
++i;
break;
}
else if(chars[j-1]==chars[i-1])
{
next[i+1] = next[temp] + 1;//这里temp与J总是相隔一个位,所以是next[temp]
++i;
break;
}
}

}
else if(chars[i-1]==chars[next[i]-1]) //当测试next值上的数据与当前数据相等时进行
{
next[i+1] = next[i] + 1;
++i;
}
printf("next[%d]=%d\n",i,next[i]);
}
}

void next_change(char *chars,int nextval[])
{
int i,j,temp;

i = 1;
nextval[1] = 0;
for(j=1;chars[j];++j)
{
temp = next[j+1]; //取得当前的next[X]值
if(chars[j]==chars[temp-1]) //比较J位置上与相对于J位置的NEXT位上的元素值是否相等
{
nextval[j+1] = nextval[temp]; //如相等则将前面的nextval值赋给当前nextval的值
}
else nextval[j+1] = temp; //不相等则保留原next[]中的值
}
}
int Index(HString S,HString T,int pos)
{
int i,j;

i = pos-1;
j = 0;

get_next(T.ch,next);
next_change(T.ch,nextval);

while(i<=S.length && T.ch[j]) //字符串没到结尾不结束查找
{
if(S.ch[i]==T.ch[j])//相等则一起后移
{
i++;j++;
}
else if(S.ch[i]!=T.ch[j])
{
j = nextval[j+1]-1;//不相等时取得next值-1因为
//next是按1,2,3...算所以要-1
if(j<=0 && S.ch[i]!=T.ch[j])
{
i++;//J移到next值上如值是<0则i向前移
j = 0;//因为j可以变成小于0
}

}

}
if(j>=T.length) return i-T.length+1;
else return 0;
}

void StrInsert(HString *s,int pos,HString T) //在pos位置插入字符串T
{
int i,j;

if(pos<1 || pos>(s->length+1))
{
printf("strInsert's Location error!\n");
exit(1);
}

if(T.length)
s->ch = (char*)realloc(s->ch,(s->length+T.length+1)*sizeof(char)); //增加S的空间

for(j=s->length;j>=pos-1;--j) //POS位置到最后的字符往后移
s->ch[j+T.length] = s->ch[j];

for(i=0;i<T.length;++i) //T复制到S
{
s->ch[i+pos-1] = T.ch[i];
}

s->length = s->length + T.length;
}

void StrDelete(HString *s,int pos,int len)//S存在,从S中删除第POS个字符起长度为LEN的子串
{
int i,j;

if(pos<1 || pos>s->length-len) //判断删除位置是否合理
printf("delete Location error!\n");
else
{
for(i=pos+len-1,j=0;i<s->length;++i,++j) //删除中间元素,后面的元素往前移
s->ch[pos-1+j] = s->ch[i];
s->length = s->length - len;
s->ch[s->length] = '\0';
}
}

void Replace(HString *s,HString t,HString v) //将V替换掉S中的T
{
int i;
i = Index(*s,t,1);

while(i>0)
{
StrDelete(s,i,t.length);
StrInsert(s,i,v);
i = Index(*s,t,1);
}
}
void display(HString s)
{
printf("the string is :%s\n",s.ch);
}

int main(void)
{
HString obj,obj2,obj3,obj4;

obj.ch = NULL;//(char*)malloc(sizeof(char));
obj2.ch = NULL;
obj3.ch = NULL;
obj4.ch = NULL;
StrAssign(&obj,"august");
StrAssign(&obj2,"yx");
StrAssign(&obj4,"ax");
display(obj);
display(obj2);
SubString(&obj3,obj,3,3);
display(obj3);
StrInsert(&obj3,1,obj2);
display(obj3);
Replace(&obj3,obj2,obj4);
display(obj3);
StrDelete(&obj3,1,3);
display(obj3);
return 0;
}

// 希望能够帮到你

⑦ c语言程序设计题 50行的,急需!

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct stu
{
int num;//编号
char name[30];//姓名
char fm[30];//性别
char tel[30];//电话号码
char dz[30];//地址
int cj;//成绩
int sum;//排名

};
int i=0;
int z;
void ss1(struct stu u[]);
void ss2(struct stu u[]);
void ss3(struct stu u[]);
void ss4(struct stu u[]);
void ss5(struct stu u[]);
void ss6(struct stu u[]);
void main()
{
int x;
char m;
struct stu u[40];
printf("---------------欢迎使用通讯录----------------------\n");
do
{
printf("学号:%d\n",i+1);
u[i].num=i+1;
printf("姓名:\n");
scanf("%s",u[i].name);
printf("性别:\n");
scanf("%s",u[i].fm);
printf("电话号码:\n");
scanf("%s",u[i].tel);
printf("地址:\n");
scanf("%s",u[i].dz);
printf("成绩:\n");
scanf("%d",&u[i].cj);
i++;
printf("是否继续输入?(y\\n)");
scanf(" %c",&m);
}while(m=='Y'||m=='y');
do
{

printf("〓 通讯录 〓\n");
printf("〓 0.退 出 〓\n");
printf("〓 1.查 找 〓\n");
printf("〓 2.添 加 〓\n");
printf("〓 3.删 除 〓\n");
printf("〓 4.修 改 〓\n");
printf("〓 5.浏览信息 〓\n");
printf("〓 6.成绩排名 〓\n");
printf("〓〓〓〓〓〓〓〓〓〓〓〓〓\n");
printf("请选择:\n");
scanf("%d",&x);
switch(x)
{
case 0:exit(0);break;
case 1:ss1(u);break;
case 2:ss2(u);break;
case 3:ss3(u);break;
case 4:ss4(u);break;
case 5:ss5(u);break;
case 6:ss6(u);break;
}
printf("是否选择其它功能(y\\n)");
scanf(" %c",&m);
}while(m=='Y'||m=='y');
}
void ss1(struct stu u[])
{
char name[20];
int j;
printf("请输入您要查找的姓名");
scanf("%s",name);
for(j=0;j<i;j++)
{
if(strcmp(u[j].name,name)==0)
break;
}
if(j==i)
printf("查无此人");
else
printf("学号:%d 姓名:%s 电话号码%s 地址%s 成绩%d\n",u[j].num,u[j].name,u[j].tel,u[j].dz,u[j].cj);
}
void ss2(struct stu u[])
{
char m;
do
{
printf("学号:%d\n",z+1);
u[i].num=z+1;
printf("姓名:\n");
scanf("%s",u[i].name);
printf("性别:\n");
scanf("%s",u[i].fm);
printf("电话号码\n");
scanf("%s",u[i].tel);
printf("地址:\n");
scanf("%s",u[i].dz);
printf("成绩:\n");
scanf("%d",&u[i].cj);
z++;
i++;
printf("是否继续输入?(y\\n)");
scanf(" %c",&m);
}while(m=='Y'||m=='y');
}

void ss3(struct stu u[])
{
int j,k,num;
printf("请输入您要删除的学号");
scanf("%d",&num);
for(j=0;j<i;j++)
{
if(u[j].num==num)
break;
}
if(j==i)
printf("查无此人");
else
{
for(k=j;k<i-1;k++)
{
u[k]=u[k+1];
}
z=i;
i--;
printf("---------------------删除成功---------------------\n");
}

}
void ss4(struct stu u[])
{
int num,j,k;
char m;
printf("请选择您要修改的学号:");
scanf("%d",&num);
for(j=0;j<i;j++)
{
if(u[j].num==num)
break;
}
if(j==i)
printf("查无此人");
else
{
do
{
printf("学号:%d\n",num);
u[i].num=num;
for(k=j;k<i-1;k++)
{
u[k]=u[k+1];
}
i--;

printf("姓名:\n");
scanf("%s",u[i].name);
printf("性别:\n");
scanf("%s",u[i].fm);
printf("电话号码\n");
scanf("%s",u[i].tel);
printf("地址:\n");
scanf("%s",u[i].dz);
printf("成绩:\n");
scanf("%d",&u[i].cj);
i++;
printf("-----------------------修改完毕-----------------------\n");
printf("是否继续输入?(y\\n)");
scanf(" %c",&m);
}while(m=='Y'||m=='y');
}
}

void ss5(struct stu u[])
{
int j;
for(j=0;j<i;j++)
{
printf("学号:%d 姓名:%s 电话号码%s 地址%s 成绩%d\n",u[j].num,u[j].name,u[j].tel,u[j].dz,u[j].cj);
}
if(i==0)
{
printf("当前没有信息");
}

}
void ss6(struct stu u[])
{
int j,k,h;
char p[30];
int sum=0;
for(j=0;j<i-1;j++)
{
for(k=j+1;k<i;k++)
{
if(u[j].cj<u[k].cj)
{
h=u[j].cj;
u[j].cj=u[k].cj;
u[k].cj=h;
h=u[j].num;
u[j].num=u[k].num;
u[k].num=h;
strcpy(p,u[j].name);
strcpy(u[j].name,u[k].name);
strcpy(u[k].name,p);
strcpy(p,u[j].tel);
strcpy(u[j].tel,u[k].tel);
strcpy(u[k].tel,p);
strcpy(p,u[j].dz);
strcpy(u[j].dz,u[k].dz);
strcpy(u[k].dz,p);
}
}
}
for(j=0;j<i;j++)
{
printf("排名:%d学号:%d 姓名:%s 电话号码%s 地址%s 成绩%d\n",sum+1,u[j].num,u[j].name,u[j].tel,u[j].dz,u[j].cj);
sum++;
}
}

⑧ 求一个50行左右的C语言编程

这是一个玩五子棋的例子:
#include <iostream.h>
#include <process.h>
#include <conio.h>
class five
{
int x;
int y;
int m;
int n;
int num_xy;
int num_mn;
char qipan[20][20];
public:
five(int X = 0,int Y =0,int M = 0,int N = 0,int Num_xy = 0,int Num_mn = 0)
{
x = X;
y = Y;
m = M;
n = N;
num_xy = Num_xy;
num_mn = Num_mn;
for(int i = 0 ; i < 20 ; i ++)
{
for(int j = 0 ;j < 20 ; j ++)
qipan[i][j] = '.';
}

}
int getm()
{
return m;
}
int getn()
{
return n;
}
void getpointxy();
void getpointmn();
void machinemn();
void showqipan();
void print();
bool IsxyWin();
bool IsmnWin();
int dangerlevel(int a,int b);
void attack();
};
void five::getpointxy()
{
cout<<"请分别输入第"<<num_xy+1<<"步白棋('o')的横坐标和纵坐标:";
cin >> x >> y;
if(x <= 0 || y <= 0 || x > 20 || y > 20 )
{
cout << "出界,请重新输入:"<<endl ;
getpointxy();
}
else if(qipan[y-1][x-1] != '.' )
{
cout << "请所下的位置已经有棋子,请重新输入:" <<endl;
getpointxy();
}
else if(num_xy+num_mn >= 400)
{
cout << "棋盘已满,平局!" << endl;
exit(0);
}
else
{
qipan[y-1][x-1] = 'o';
num_xy++;
}

}
void five::getpointmn()
{
cout<<"请分别输入第"<<num_mn+1<<"步黑棋('x')的横坐标和纵坐标:";
cin >> m >> n;
if(m <= 0 || n <= 0 || m > 20 || n > 20 )
{
cout << "出界,请重新输入:"<<endl ;
getpointmn();
}
else if(qipan[n-1][m-1]!='.')
{
cout << "请所下的位置已经有棋子,请重新输入:" <<endl;
getpointmn();
}
else if(num_xy+num_mn >= 400)
{
cout << "棋盘已满,平局!" << endl;
exit(0);
}
else
{
qipan[n-1][m-1] = 'x';
num_mn++;
}

}

int five::dangerlevel(int a, int b)
{
int level = 0;
for(int i = 1 ; a+i<=19; i ++)
{
if(qipan[a+i][b] == '.' && a + i <= 19)
{
i = i+1;
break;
}
if(qipan[a +i][b] == 'x' && a + i <= 19)
break;

}
level += (i-1);
for(i = 1 ; a-i>=0; i ++)
{
if(qipan[a-i][b] == '.' && (a-i) >= 0)
{
i = i+1;
break;
}
if(qipan[a-i][b] == 'x' && (a-i) >= 0)
break;
}
level += (i-1);
for(i = 1 ; b+i<=19 ; i ++)
{
if(qipan[a][b + i] == '.' && b + i <= 19)
{
i = i+1;
break;
}
if(qipan[a][b + i] == 'x' && b + i <= 19)
break;
}
level += (i-1);
for( i = 1 ; b-i>=0 ; i ++)
{
if(qipan[a][b - i] == '.' && (b-i) >= 0)
{
i = i+1;
break;
}
if(qipan[a][b - i] == 'x' && (b-i) >= 0)
break;
}
for( i = 1 ; a+i<=19&& b+i<=19; i ++)
{
if(qipan[a + i][b + i] == '.' && b+i <= 19 && a+i <= 19)
{
i = i+1;
break;
}
if(qipan[a + i][b + i] == 'x' && b+i <= 19 && a+i <= 19)
break;
}
level += (i-1);
for( i = 1 ; a-i>= 0 && b-i >= 0; i ++)
{
if(qipan[a - i][b - i] == '.' && a-i>= 0 && b-i >= 0)
{
i = i+1;
break;
}
if(qipan[a - i][b - i] == 'x' && a-i>= 0 && b-i >= 0)
break;
}
level += (i-1);
for( i = 1 ; a-i>= 0 && b+i <= 19 ; i ++)
{
if(qipan[a - i][b + i] == '.' && a-i>= 0 && b+i <= 19)
{
i = i+1;
break;
}
if(qipan[a - i][b + i] == 'x' && a-i>= 0 && b+i <= 19)
break;
}
level += (i-1);
for( i = 1 ; a + i<= 19 && b-i >= 0 ; i ++)
{
if(qipan[a + i][b - i] == '.' && a + i<= 19 && b-i >= 0)
{
i = i+1;
break;
}
if(qipan[a + i][b - i] == 'x' && a + i<= 19 && b-i >= 0)
break;
}
level += (i-1);
return level;
}

void five::attack()
{
int num1=1,num2=1,num3=1,num4=1;
int A = 20 , B = 20 ,max = 0;
for(int a = 0 ; a < 19 ; a ++)
{
for(int b = 0 ; b < 19 ; b ++)
{
if(qipan[a][b] == '.')
{
int level = 0;
for(int i = 1 ; a+i<=19; i ++)
{
if(qipan[a+i][b] == '.' && a + i <= 19)
{
i = i+1;
break;
}
if(qipan[a +i][b] == 'o' && a + i <= 19)
break;

}
level += (i-1);
for(i = 1 ; a-i>=0; i ++)
{
if(qipan[a-i][b] == '.' && (a-i) >= 0)
{
i = i+1;
break;
}
if(qipan[a-i][b] == 'o' && (a-i) >= 0)
break;
}
level += (i-1);
for(i = 1 ; b+i<=19 ; i ++)
{
if(qipan[a][b + i] == '.' && b + i <= 19)
{
i = i+1;
break;
}
if(qipan[a][b + i] == 'o' && b + i <= 19)
break;
}
level += (i-1);
for( i = 1 ; b-i>=0 ; i ++)
{
if(qipan[a][b - i] == '.' && (b-i) >= 0)
{
i = i+1;
break;
}
if(qipan[a][b - i] == 'o' && (b-i) >= 0)
break;
}
for( i = 1 ; a+i<=19&& b+i<=19; i ++)
{
if(qipan[a + i][b + i] == '.' && b+i <= 19 && a+i <= 19)
{
i = i+1;
break;
}
if(qipan[a + i][b + i] == 'o' && b+i <= 19 && a+i <= 19)
break;
}
level += (i-1);
for( i = 1 ; a-i>= 0 && b-i >= 0; i ++)
{
if(qipan[a - i][b - i] == '.' && a-i>= 0 && b-i >= 0)
{
i = i+1;
break;
}
if(qipan[a - i][b - i] == 'o' && a-i>= 0 && b-i >= 0)
break;
}
level += (i-1);
for( i = 1 ; a-i>= 0 && b+i <= 19 ; i ++)
{
if(qipan[a - i][b + i] == '.' && a-i>= 0 && b+i <= 19)
{
i = i+1;
break;
}
if(qipan[a - i][b + i] == 'o' && a-i>= 0 && b+i <= 19)
break;
}
level += (i-1);
for( i = 1 ; a + i<= 19 && b-i >= 0 ; i ++)
{
if(qipan[a + i][b - i] == '.' && a + i<= 19 && b-i >= 0)
{
i = i+1;
break;
}
if(qipan[a + i][b - i] == 'o' && a + i<= 19 && b-i >= 0)
break;
}
level += (i-1);
if(level >= max)
{
n = a + 1;
m = b + 1;
max = level;
}
}
else
continue;
}
}
qipan[n-1][m-1] = 'x';
}
void five::machinemn()
{

int Num1=1,Num2=1,Num3=1,Num4=1,A11 = 21,A12 = 21,A21 = 21,A22 = 21,A31 = 21,A32 = 21,A41 = 21,A42 = 21;
for(int i = x ; i < x+5&& x+5<20 ; i ++)
{
if(qipan[y-1][i] == '.')
{
A11=i;
break;
}
if(qipan[y-1][i] == 'x')
break;
if(qipan[y-1][i] == 'o')
Num1++;
}
for(i = x-2; i >= 0 ; i --)
{
if(qipan[y-1][i] == '.')
{
A12 = i;
break;
}
if(qipan[y-1][i] == 'x')
{
break;
}
if(qipan[y-1][i] == 'o')
Num1++;
}
////

for( i = y ; i < y+5 && y+5 < 20 ; i ++)
{
if(qipan[i][x-1] == '.')
{
A21 = i;
break;
}
if(qipan[i][x-1] == 'x')
{
break;
}
if(qipan[i][x-1] == 'o')
Num2++;
}
for(i = y-2; i >= 0 ; i --)
{
if(qipan[i][x-1] == '.')
{
A22 = i;
break;
}
if(qipan[i][x-1] == 'x')
{
break;
}
if(qipan[i][x-1] == 'o')
Num2++;
}
////
for(i = 0 ; i < 5 && x+i<20 && y+i<20; i++ )
{
if(qipan[y+i][x+i] == '.')
{
A31 = i;
break;
}
if(qipan[y+i][x+i] == 'x')
{
break;
}
if(qipan[y+i][x+i] =='o')
Num3++;
}
for(i = 0 ; x - i -2>=0 && y-i-2>=0 && i < 5;i++ )
{
if(qipan[y-i-2][x-i-2] == '.')
{
A32 = i;
break;
}
if(qipan[y-i-2][x-i-2] == 'x')
break;
if(qipan[y-i-2][x-i-2] == 'o')
Num3++;
}
////
for(i = 0 ; x + i < 20 && y - i - 2 >= 0 && i < 5;i ++)
{
if(qipan[y-i-2][x+i] == '.')
{
A41 = i;
break;
}
if(qipan[y-i-2][x+i] == 'x')
{
break;
}
if(qipan[y-i-2][x+i] == 'o')
Num4++;
}
for(i = 0 ; y + i < 20 && x - i - 2 >= 0 && i < 5;i ++)
{
if(qipan[y+i][x-i-2] == '.')
{
A42 = i;
break;
}
if(qipan[y+i][x-i-2] == 'x')
{
break;
}
if(qipan[y+i][x-i-2] == 'o')
Num4++;
}
////
if(num_xy == 0 && num_xy == 0)
{
m = n = 10;
qipan[m-1][n-1] = 'x';
}
else if(num_xy == 1)
attack();
else if(num_xy == 1)
{
m = x+1;
n = x+1;
qipan[m-1][n-1] = 'x';
}
else if(Num1 == 4 && A11 == 21 && A12 != 21) //一排四个右边一头堵住
{
n =1 + y-1;
m = 1 + A12;
qipan[y-1][A12] = 'x';
}
else if(Num1 == 4 && A12 == 21 && A11 != 21) //一排四个左边边一头堵住
{
n =1 + y-1;
m = 1 + A11;
qipan[y-1][A11] = 'x';
}
else if(Num2 == 4 && A21 == 21 && A22 != 21) //一列四个下边一头堵住
{
n =1 + A22;
m = 1 + x-1;
qipan[A22][x-1] = 'x';
}
else if(Num2 == 4 && A22 == 21 && A21 != 21) //一列四个上边一头堵住
{
n =1 + A21;
m = 1 + x-1;
qipan[A21][x-1] = 'x';
}
else if(Num3 == 4 && A31 == 21 && A32 != 21) //一左上右下斜列四个右边一头堵住
{
n =1 + y - A32 - 2;
m = 1 + x - A32 - 2;
qipan[y-A32-2][x-A32-2] = 'x';
}
else if(Num3 == 4 && A32 == 21 && A31 != 21) //一左上右下斜列四个左边一头堵住
{
n =1 + y + A31;
m = 1 + x + A31;
qipan[y+A31][x+A31] = 'x';
}
else if(Num4 == 4 && A41 == 21 && A42 != 21) //一左下右上斜列四个右边一头堵住
{
n =1 + y + A42;
m = 1 + x - A42 - 2;
qipan[y+A42][x-A42-2] = 'x';
}
else if(Num4 == 4 && A42 == 21 && A41 != 21) //一左下右上斜列四个左边一头堵住
{
n =1 + y - A41 - 2;
m = 1 + x + A41;
qipan[y-A41-2][x+A41] = 'x';
}
else if(Num1==3 && A11 != 21 && A12 != 21) //一排3 个两头没堵
{
n =1 + y-1;
m = 1 + A11;
if(dangerlevel(y-1,A11) >= dangerlevel(y-1,A12))
qipan[y-1][A11] = 'x';
else
qipan[y-1][A12] = 'x';

}
else if(Num2==3&& A21 != 21 && A22 != 21) //一列 3 个两头没堵
{
n =1 + A21;
m = 1 + x-1;
if(dangerlevel(A21,x-1) >= dangerlevel(A22,x-1))
qipan[A21][x-1] = 'x';
else
qipan[A22][x-1] = 'x';
}
else if(Num3 == 3&& A31 != 21 && A32 != 21) //一左上右下斜列3 个两头没堵
{
n =1 + y + A31;
m = 1 + x + A31;
if(dangerlevel(y+A31,x+A31) >= dangerlevel(y-A32 - 2,y - A32 -2))
qipan[y+A31][x+A31] = 'x';
else
qipan[y-A32-2][x-A32 -2] = 'x';

}
else if(Num4==3 && A41 != 21 && A42 != 21) //一左下右上斜列3 个两头没堵
{
n =1 + y - A41 - 2;
m = 1 + x + A41;
if(dangerlevel(y-A41-2,x+A41) >= dangerlevel(y-A42-2,x+A42))
qipan[y-A41-2][x+A41] = 'x';
else
qipan[y-A42-2][x+A42] = 'x';
}
else if(Num1 == 2&& A11 != 21 && A12 != 21) //一排2个两头没堵
{
n =1 + y-1;
m = 1 + A11;
qipan[y-1][A11] = 'x';
}

else if( Num2 == 2&& A21 != 21 && A22 != 21) //一列2个两头没堵
{
n =1 + A21;
m = 1 + x-1;
qipan[A21][x-1] = 'x';
}
else if(Num3 == 2&& A31 != 21 && A32 != 21) //一左上右下斜列2 个两头没堵
{
n =1 + y + A31;
m = 1 + x + A31;
qipan[y+A31][x+A31] = 'x';
}
else if(Num4==2 && A41 != 21 && A42 != 21) //一左下右上斜列2个两头没堵
{
n =1 + y - A41 - 2;
m = 1 + x + A41;
qipan[y-A41-2][x+A41] = 'x';
}
else
attack();
}

void five::showqipan()
{
int p=0,q=0;
for(int i = 0 ; i <= 20 ; i++)
{

if(p<10)
{
cout << p <<' ';
}
else
cout << p ;
p++;
}
cout << endl;
for(i = 0 ; i < 20 ; i++)
{
if(i>=0)
{
q++;
if(q<10)
cout << q <<' ';
else
cout << q;
}
for(int j = 0 ; j < 20 ; j ++)
cout << qipan[i][j]<<' ' ;

cout << endl;
}
}

void five::print()
{
int p=0,q=0;
for(int i = 0 ; i <= 20 ; i++)
{

if(p<10)
{
cout << p <<' ';
}
else
cout << p ;
p++;
}
cout << endl;
for(i = 0 ; i < 20 ; i++)
{
if(i>=0)
{
q++;
if(q<10)
cout << q <<' ';
else
cout << q;
}
for(int j = 0 ; j < 20 ; j ++)
{
cout << qipan[i][j]<<' ' ;
}

cout << endl;
}
}

bool five::IsxyWin()
{
int num1=1,num2=1,num3=1,num4=1;
for(int i = x ; i < x+5&& x+5<20 ; i ++)
{
if(qipan[y-1][i] != 'o')
break;
if(qipan[y-1][i] == 'o')
num1++;
}
for(i = x-2; i >= 0 ; i --)
{
if(qipan[y-1][i] != 'o')
break;
if(qipan[y-1][i] == 'o')
num1++;
}
for( i = y ; i < y+5 ; i ++)
{
if(qipan[i][x-1] != 'o')
break;
if(qipan[i][x-1] == 'o')
num2++;
}
for(i = y-2; i >= 0 ; i --)
{
if(qipan[i][x-1] != 'o')
break;
if(qipan[i][x-1] == 'o')
num2++;
}
for(i = 0 ; i < 5 && x+i<20 && y+i<20; i++ )
{
if(qipan[y+i][x+i] != 'o')
break;
if(qipan[y+i][x+i] =='o')
num3++;
}
for(i = 0 ; x - i -2>=0 && y-i-2>=0 && i < 5;i++ )
{
if(qipan[y-i-2][x-i-2] != 'o')
break;
if(qipan[y-i-2][x-i-2] == 'o')
num3++;
}
for(i = 0 ; x + i < 20 && y - i - 2 >= 0 && i < 5;i ++)
{
if(qipan[y-i-2][x+i] != 'o')
break;
if(qipan[y-i-2][x+i] == 'o')
num4++;
}
for(i = 0 ; y + i < 20 && x - i - 2 >= 0 && i < 5;i ++)
{
if(qipan[y+i][x-i-2] != 'o')
break;
if(qipan[y+i][x-i-2] == 'o')
num4++;
}
if(num1>=5||num2>=5||num3>=5||num4>=5)
return 1;
else
return 0;

}
bool five::IsmnWin()
{
int num1=1,num2=1,num3=1,num4=1;
for(int i = m ; i < m+5&& m+5<20 ; i ++)
{
if(qipan[n-1][i] != 'x')
break;
if(qipan[n-1][i] == 'x')
num1++;
}
for(i = m-2; i >= 0 ; i --)
{
if(qipan[n-1][i] != 'x')
break;
if(qipan[n-1][i] == 'x')
num1++;
}
for( i = n ; i < n+5 ; i ++)
{
if(qipan[i][m-1] != 'x')
break;
if(qipan[i][m-1] == 'x')
num2++;
}
for(i = n-2; i >= 0 ; i --)
{
if(qipan[i][m-1] != 'x')
break;
if(qipan[i][m-1] == 'x')
num2++;
}
for(i = 0 ; i < 5 && m+i<20 && n+i<20; i++ )
{
if(qipan[n+i][m+i] != 'x')
break;
if(qipan[n+i][m+i] =='x')
num3++;
}
for(i = 0 ; m - i -2>=0 && n-i-2>=0 && i < 5;i++ )
{
if(qipan[n-i-2][m-i-2] != 'x')
break;
if(qipan[n-i-2][m-i-2] == 'x')
num3++;
}
for(i = 0 ; m + i < 20 && n - i - 2 >= 0 && i < 5;i ++)
{
if(qipan[n-i-2][m+i] != 'x')
break;
if(qipan[n-i-2][m+i] == 'x')
num4++;
}
for(i = 0 ; n + i < 20 && m - i - 2 >= 0 && i < 5;i ++)
{
if(qipan[n+i][m-i-2] != 'x')
break;
if(qipan[n+i][m-i-2] == 'x')
num4++;
}
if(num1>=5||num2>=5||num3>=5||num4>=5)
return 1;
else
return 0;

}

void main()
{
five a;
int temp;
cout << "欢迎体验本游戏!这是本游戏的棋盘:" << endl;
a.showqipan();
cout << "双人游戏请按1,人机游戏请按2,退出请按3:";
cin >> temp;
if(temp == 3)
exit(1);
if(temp == 1)
{
cout << "您选择了双人游戏,下面游戏开始:" << endl;
for(int i = 0 ; ; i ++)
{
a.getpointxy();
a.print();
if(a.IsxyWin())
{
cout << "白棋胜!" << endl;
break;
}
a.getpointmn();
a.print();
if(a.IsmnWin())
{
cout << "黑棋胜!" << endl;
break;
}
}
}
if(temp == 2)
{
int temp1=0;
cout << "您选择了人机游戏,您是白棋('o'),电脑是黑棋('x'),下面游戏开始:" << endl;
cout << "您先下请按1,电脑先下请按2:";
cin >> temp1;
if(temp1 == 1)
{
for(int i = 0 ; ; i ++)
{
a.getpointxy();
a.print();
if(a.IsxyWin())
{
cout << "你赢了!恭喜!" << endl;
break;
}
a.machinemn();
a.print();
cout << "电脑走(" << a.getm() << ',' << a.getn() << ')' << endl;
if(a.IsmnWin())
{
cout << "哈哈,你输了!" << endl;
break;
}
}
}
if(temp1 == 2)
{
for(int i = 0 ; ; i ++)
{
a.machinemn();
a.print();
if(a.IsmnWin())
{
cout << "哈哈,你输了!" << endl;
break;
}
a.getpointxy();
a.print();
if(a.IsxyWin())
{
cout << "你赢了!恭喜!" << endl;
break;
}

}
}
}
cout << "Press any key to EXIT\n";
getch();
}

热点内容
安卓上哪里下大型游戏 发布:2024-12-23 15:10:58 浏览:189
明日之后目前适用于什么配置 发布:2024-12-23 14:56:09 浏览:55
php全角半角 发布:2024-12-23 14:55:17 浏览:828
手机上传助手 发布:2024-12-23 14:55:14 浏览:732
什么样的主机配置吃鸡开全效 发布:2024-12-23 14:55:13 浏览:830
安卓我的世界114版本有什么 发布:2024-12-23 14:42:17 浏览:710
vbox源码 发布:2024-12-23 14:41:32 浏览:278
诗经是怎么存储 发布:2024-12-23 14:41:29 浏览:660
屏蔽视频广告脚本 发布:2024-12-23 14:41:24 浏览:419
php解析pdf 发布:2024-12-23 14:40:01 浏览:818