default: break; } charge(); } void charge() { Sleep(500); switch(snake_fx) { case 1:snake_hair_x++;break; case 2:snake_hair_x--;break; case 3:snake_hair_y--;break; case 4:snake_hair_y++;break; default:break; } } int main() { while(1) { get_char(); } }
#include<stdio.h> #include<stdlib.h> #include<windows.h> #include<conio.h> #include<dos.h> char snake_fx=NULL; char snake_body[20][20][400]; char snake_hair_y,snake_hair_x; void charge(); void get_char(); void get_char() { char key; key=_getch(); switch(key) { case 'w':snake_fx=1;break; case 's':snake_fx=2;break; case 'a':snake_fx=3;break; case 'd':snake_fx=4;break; default: break; } charge(); } void charge() { Sleep(500); switch(snake_fx) { case 1:snake_hair_x++;break; case 2:snake_hair_x--;break; case 3:snake_hair_y--;break; case 4:snake_hair_y++;break;
while(1) { key=NULL; key=getchar(); if(key=='w'&&(weizhi_y-1)==0&&weizhi_y-1>=0) weizhi_y--; else if(key=='s'&&(weizhi_y+1)==0&&weizhi_y+1<=10) weizhi_y--; else if(key=='a'&&(weizhi_x-1)==0&&weizhi_y-1>=0) weizhi_y--; else if(key=='d'&&(weizhi_x+1)==0&&weizhi_y-1<=10) weizhi_y--; else if(key==NULL) printf("error,please return \n"); } }
#include<stdio.h> int map[10][10]={1,1,1,1,1,1,1,1,1,1, 0,0,0,1,0,0,0,1,0,1, 1,1,0,1,0,0,0,1,0,1, 1,0,0,0,0,1,1,0,0,1, 1,0,1,1,1,0,0,0,0,1, 1,0,0,0,1,0,0,0,0,1, 1,0,1,0,0,0,1,0,0,1, 1,0,1,1,1,0,1,1,0,1, 1,1,0,0,0,0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1}; int main() { int enter_x,enter_y; int exit_x,exit_y; int weizhi_x,weizhi_y; char key; printf("please input enter_(x,y) and exit_(x,y) : \n"); scanf("(%d,%d) (%d,%d)",&enter_x,&enter_y,&exit_x,&exit_y); while(1) { key=NULL; key=getchar(); if(key=='w'&&(weizhi_y-1)==0&&weizhi_y-1>=0)
#include<stdio.h> int math[10][10]={1,1,1,1,1,1,1,1,1,1, 0,0,0,1,0,0,0,1,0,1, 1,1,0,1,0,0,0,1,0,1, 1,0,0,0,0,1,1,0,0,1, 1,0,1,1,1,0,0,0,0,1, 1,0,0,0,1,0,0,0,0,1, 1,0,1,0,0,0,1,0,0,1, 1,0,1,1,1,0,1,1,0,1, 1,1,0,0,0,0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1}; int main() { scanf("",&); while(1) { } }
IP判断 (C++代码)浏览:728 |
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:766 |
C语言程序设计教程(第三版)课后习题7.4 (C语言代码)浏览:488 |
C语言程序设计教程(第三版)课后习题10.2 (C语言代码)浏览:689 |
大神老白 (C语言代码)浏览:768 |
C语言训练-自由落体问题 (C语言代码)浏览:1775 |
最小公倍数 (C语言代码)浏览:894 |
妹子杀手的故事 (C语言代码)浏览:1297 |
C语言程序设计教程(第三版)课后习题6.3 (C++代码)浏览:1067 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:624 |