C语言编程题(设计一个猜数字的小游戏)满意再加200分!!!!
虽然做得不好,但我还是决定发过来,必境花了点时间嘛
cf小游戏代码_cf进游戏直接代码
#include
#include
#include
#include
#include
void fun(int n)
{char name[10];
if(n<6)
{printf("请输入姓名:");
scanf("%s",name);
}switch(1)
{case 1:printf("第一名:%s\n",n==1?name:"jone");
case 2:printf("第二名:%s\n",n==2?name:"jim");
case 3:printf("第三名:%s\n",n==3?name:"tank");
case 4:printf("第四名:%s\n",n==4?name:"ling");
case 5:printf("第五名:%s\n",n==5?name:"hai");
default:if(n>5)printf("继续努力!!!");
}}
void main()
{int a[4],b[4],i,j,s=0,m,n,g,gs,g1,flag=0;char ch,str,strch;
srand((unsigned)time(NULL));
do{s=0;
do{
g=rand()%9999+1;g1=g;
if(g1>1000)
{ for(i=3;i>=0;i--)
{a[i]=g%10;
g/=10;}
for(i=0;i<4;i++)
for(j=0;j<4;j++)
if(a[i]!=a[j]&&i!=j)flag=1;
else if(i==j)continue;
if(flag)goto loop;
}}while(1);
loop:
printf("%d",g1);//
do{s++;n=0;m=0;
printf("\n请输入一个4位数:");
scanf("%4d",&gs);
for(j=3;j>=0;j--)
{b[j]=gs%10;gs/=10;
}for(i=0,j=0;i<4,j<4;)
if(a[i++]==b[j++])m++;
for(i=0;i<4;i++)
for(j=0;j<4;j++)
if(a[i]==b[j]){n++;break;}
if(m<4)printf("\n猜对了%d个,位置对了%d个。",n,m);
if(m==4){printf("\n恭喜您赢了!共猜了%d次\n",s);
printf("是否查看排行榜y/n:");
getchar();
str=getchar();
if(str=='y')fun(s);
printf("要清屏请输入y:");
strch=getche();
if(strch=='y')system("cls");
else break;}
if(s==10){printf("\n您失败了!!!");printf("\n数字是%d",g1);break;}
}while(s<10);
printf("\n从来吗y/n:");
scanf(" %c",&ch);
if(ch=='n')exit(1);
}while(1);
}
#include "stdio.h"
#include "math.h"
#include
#include
void main( void )
{int i, k, s;
int a[ 4 ];
int N = 0, M = 0;
int b[ 4 ];
srand( ( unsigned ) time( NULL ) );
for ( i = 0; i <= 3;i++ )
{a: a[ i ] = rand() % 10;
for ( s = 0;s < i;s++ )
{if ( a[ s ] == a[ i ] )
goto a;
}//END//
printf( " %d\n", a[ i ] );
}printf( "qingshuru:\n" );
for ( k = 0;k <= 3;k++ )
{scanf( "%d", &b[ k ] );
}for ( i = 0;i <= 3;i++ )
{for ( k = 0;k <= 3;k++ )
if ( a[ i ] == b[ k ] )
{if ( i == k )
N++;
//break;
if ( i != k )
M++;
//break;
}}
printf( "%d\n%d\n", N, M );
}
晕~~~
这个 相当于一个 项目了~~~
很难类~~ 没有几十天 是 做不出来(我)
哎~~~~
期待 高手帮你吧!!
为什么要用C语言呢?
没有界面 也很难看!!
用 JAVA啊 WinFrom也行啊!!
界面漂亮好看!!
C语言太 枯燥了
#include
#include
#include
int main()
{srand(time(0L));
int result=0;
result=rand()%100;
printf("Enter you guess number: \n")
}
自己过去看吧,一点也不难,
这种游戏恐怕要用c++工程来做
用C++编写的小游戏源代码
以下是贪吃蛇源代码:
#include
#include
#include
#include
#include
#define N 21
void gotoxy(int x,int y)//位置函数
{COORD pos;
pos.X=2x;
pos.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}void color(int a)//颜色函数
{SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
}void init(int apple[2])//初始化函数(初始化围墙、显示信息、苹果)
{int i,j;//初始化围墙
int wall[N+2][N+2]={{0}};
for(i=1;i<=N;i++)
{for(j=1;j<=N;j++)
wall[i][j]=1;
}color(11);
for(i=0;i {for(j=0;j {if(wall[i][j]) cout<<"■"; else cout<<"□" ; }cout< }gotoxy(N+3,1);//显示信息 color(20); cout<<"按 W S A D 移动方向"< gotoxy(N+3,2); color(20); cout<<"按任意键暂停"< gotoxy(N+3,3); color(20); cout<<"得分:"< apple[0]=rand()%N+1;//苹果 apple[1]=rand()%N+1; gotoxy(apple[0],apple[1]); color(12); cout<<"●"< }int main() {int i,j; int snake=NULL; int apple[2]; int score=0; int tail[2]; int len=3; char ch='p'; srand((unsigned)time(NULL)); init(apple); snake=(int)realloc(snake,sizeof(int)len); for(i=0;i snake[i]=(int)malloc(sizeof(int)2); for(i=0;i {snake[i][0]=N/2; snake[i][1]=N/2+i; gotoxy(snake[i][0],snake[i][1]); color(14); cout<<"★"< }while(1)//进入消息循环 {tail[0]=snake[len-1][0]; tail[1]=snake[len-1][1]; gotoxy(tail[0],tail[1]); color(11); cout<<"■"< for(i=len-1;i>0;i--) {snake[i][0]=snake[i-1][0]; snake[i][1]=snake[i-1][1]; gotoxy(snake[i][0],snake[i][1]); color(14); cout<<"★"< }if(kbhit()) {gotoxy(0,N+2); ch=getche(); }switch(ch) {case 'w':snake[0][1]--;break; case 's':snake[0][1]++;break; case 'a':snake[0][0]--;break; case 'd':snake[0][0]++;break; default: break; }gotoxy(snake[0][0],snake[0][1]); color(14); cout<<"★"< Sleep(abs(200-0.5score)); if(snake[0][0]==apple[0]&&snake[0][1]==apple[1])//吃掉苹果后蛇分数加1,蛇长加1 {score++; len++; snake=(int)realloc(snake,sizeof(int)len); snake[len-1]=(int)malloc(sizeof(int)2); apple[0]=rand()%N+1; apple[1]=rand()%N+1; gotoxy(apple[0],apple[1]); color(12); cout<<"●"< gotoxy(N+5,3); color(20); cout< }if(snake[0][1]==0||snake[0][1]==N||snake[0][0]==0||snake[0][0]==N)//撞到围墙后失败 {gotoxy(N/2,N/2); color(30); cout<<"失败!!!"< for(i=0;i free(snake[i]); Sleep(INFINITE); exit(0); }} return 0; }参考资料:从C++吧看来的 像素射击:int anim abc_fade_in 0x7f010001 int anim abc_fade_out 0x7f010002 int anim abc_grow_fade_in_from_bottom 0x7f010003 int anim abc_popup_enter 0x7f010004 int anim abc_popup_exit 0x7f010005 int anim abc_shrink_fade_out_from_bottom 0x7f010006 int anim abc_slide_in_bottom 0x7f010007 int anim abc_slide_in_top 0x7f010008 int anim abc_slide_out_bottom 0x7f010009 int anim abc_slide_out_top 0x7f01000a int anim abc_tooltip_enter 0x7f01000b int anim abc_tooltip_exit 0x7f01000c int attr actionBarDivider 0x7f040001 int attr actionBarItemBackground 0x7f040002 int attr actionBarPopupTheme 0x7f040003 int attr actionBarSize 0x7f040004 int attr actionBarSplitStyle 0x7f040005 int attr actionBarStyle 0x7f040006 int attr actionBarTabBarStyle 0x7f040007 int attr actionBarTabStyle 0x7f040008 int attr actionBarTabTextStyle 0x7f040009 int attr actionBarTheme 0x7f04000a int attr actionBarWidgetTheme 0x7f04000b int attr actionButtonStyle 0x7f04000c int attr actionDropDownStyle 0x7f04000d int attr actionLayout 0x7f04000e int attr actionMenuTextAppearance 0x7f04000f int attr actionMenuTextColor 0x7f040010 int attr actionModeBackground 0x7f040011 int attr actionModeCloseButtonStyle 0x7f040012 int attr actionModeCloseDrawable 0x7f040013 int attr actionModeCopyDrawable 0x7f040014 int attr actionModeCutDrawable 0x7f040015 int attr actionModeFindDrawable 0x7f040016 int attr actionModePasteDrawable 0x7f040017 int attr actionModePopupWindowStyle 0x7f040018 int attr actionModeSelectAllDrawable 0x7f040019 int attr actionModeShareDrawable 0x7f04001a int attr actionModeSplitBackground 0x7f04001b int attr actionModeStyle 0x7f04001c int attr actionModeWebSearchDrawable 0x7f04001d int attr actionOverflowButtonStyle 0x7f04001e int attr actionOverflowMenuStyle 0x7f04001f int attr actionProviderClass 0x7f040020 int attr actionViewClass 0x7f040021 int attr activityChooserViewStyle 0x7f040022 int attr alertDialogButtonGroupStyle 0x7f040023 int attr alertDialogCenterButtons 0x7f040024 int attr alertDialogStyle 0x7f040025 int attr alertDialogTheme 0x7f040026 int attr allowStacking 0x7f040027 int attr alpha 0x7f040028 int attr alphabeticModifiers 0x7f040029 int attr arrowHeadLength 0x7f04002a int attr arrowShaftLength 0x7f04002b int attr autoCompleteTextViewStyle 0x7f04002c int attr autoSizeMaxTextSize 0x7f04002d int attr autoSizeMinTextSize 0x7f04002e int attr autoSizePresetSizes 0x7f04002f int attr autoSizeStepGranularity 0x7f040030 int attr autoSizeTextType 0x7f040031 int attr background 0x7f040032 int attr backgroundSplit 0x7f040033 int attr backgroundStacked 0x7f040034 int attr backgroundTint 0x7f040035 int attr backgroundTintMode 0x7f040036 int attr barLength 0x7f040037 int attr borderlessButtonStyle 0x7f040038 int attr buttonBarButtonStyle 0x7f040039 int attr buttonBarNegativeButtonStyle 0x7f04003a int attr buttonBarNeutralButtonStyle 0x7f04003b int attr buttonBarPositiveButtonStyle 0x7f04003c int attr buttonBarStyle 0x7f04003d int attr buttonGrity 0x7f04003e int attr buttonIconDimen 0x7f04003f int attr buttonPanelSideLayout 0x7f040040 int attr buttonStyle 0x7f040041 int attr buttonStyleSmall 0x7f040042 int attr buttonTint 0x7f040043 int attr buttonTintMode 0x7f040044 int attr checkboxStyle 0x7f040045 int attr checkedTextViewStyle 0x7f040046 int attr closeIcon 0x7f040047 int attr closeItemLayout 0x7f040048 int attr collapseContentDescription 0x7f040049 int attr collapseIcon 0x7f04004a int attr color 0x7f04004b int attr colorAccent 0x7f04004c int attr colorBackgroundFloating 0x7f04004d int attr colorButtonNormal 0x7f04004e int attr colorControlActivated 0x7f04004f int attr colorControlHighlight 0x7f040050 int attr colorControlNormal 0x7f040051 int attr colorError 0x7f040052 int attr colorPrimary 0x7f040053 int attr colorPrimaryDark 0x7f040054 int attr colorSwitchThumbNormal 0x7f040055 int attr commitIcon 0x7f040056 int attr contentDescription 0x7f040057 int attr contentInsetEnd 0x7f040058 int attr contentInsetEndWithActions 0x7f040059 int attr contentInsetLeft 0x7f04005a int attr contentInsetRight 0x7f04005b int attr contentInsetStart 0x7f04005c int attr contentInsetStartWithNigation 0x7f04005d int attr controlBackground 0x7f04005e int attr coordinatorLayoutStyle 0x7f04005f int attr customNigationLayout 0x7f040060 int attr defaultQueryHint 0x7f040061 int attr dialogCornerRadius 0x7f040062 int attr dialogPreferredPadding 0x7f040063 int attr dialogTheme 0x7f040064 int attr displayOptions 0x7f040065 int attr divider 0x7f040066 int attr dividerHorizontal 0x7f040067 int attr dividerPadding 0x7f040068 int attr dividerVertical 0x7f040069 int attr drawableSize 0x7f04006a int attr drawerArrowStyle 0x7f04006b int attr dropDownListViewStyle 0x7f04006c int attr dropdownListPreferredItemHeight 0x7f04006d int attr editTextBackground 0x7f04006e int attr editTextColor 0x7f04006f int attr editTextStyle 0x7f040070 int attr elevation 0x7f040071 int attr expandActivityOverflowButtonDrawable 0x7f040072 int attr firstBaselineToTopHeight 0x7f040073 int attr font 0x7f040074 int attr fontFamily 0x7f040075 int attr fontProviderAuthority 0x7f040076 int attr fontProviderCerts 0x7f040077 int attr fontProviderFetchStrategy 0x7f040078 int attr fontProviderFetchTimeout 0x7f040079 int attr fontProviderPackage 0x7f04007a int attr fontProviderQuery 0x7f04007b int attr fontStyle 0x7f04007c int attr fontVariationSettings 0x7f04007d int attr fontWeight 0x7f04007e int attr gapBetweenBars 0x7f04007f int attr goIcon 0x7f040080 int attr height 0x7f040081 int attr hideOnContentScroll 0x7f040082 int attr homeAsUpIndicator 0x7f040083 int attr homeLayout 0x7f040084 int attr icon 0x7f040085 int attr iconTint 0x7f040086 int attr iconTintMode 0x7f040087 int attr iconifiedByDefault 0x7f040088 int attr imageButtonStyle 0x7f040089 int attr indeterminateProgressStyle 0x7f04008a int attr initialActivityCount 0x7f04008b int attr isLightTheme 0x7f04008c int attr itemPadding 0x7f04008d int attr keylines 0x7f04008e int attr lastBaselineToBottomHeight 0x7f04008f int attr layout 0x7f040090 int attr layout_anchor 0x7f040091 int attr layout_anchorGrity 0x7f040092 int attr layout_behior 0x7f040093 int attr layout_dodgeInsetEdges 0x7f040094 int attr layout_insetEdge 0x7f040095 int attr layout_keyline 0x7f040096 int attr lineHeight 0x7f040097 int attr listChoiceBackgroundIndicator 0x7f040098 int attr listDividerAlertDialog 0x7f040099 int attr listItemLayout 0x7f04009a int attr listLayout 0x7f04009b int attr listMenuViewStyle 0x7f04009c int attr listPopupWindowStyle 0x7f04009d int attr listPreferredItemHeight 0x7f04009e int attr listPreferredItemHeightLarge 0x7f04009f int attr listPreferredItemHeightSmall 0x7f0400a0 int attr listPreferredItemPaddingLeft 0x7f0400a1 int attr listPreferredItemPaddingRight 0x7f0400a2 int attr logo 0x7f0400a3 int attr logoDescription 0x7f0400a4 int attr maxButtonHeight 0x7f0400a5 int attr measureWithLargestChild 0x7f0400a6 int attr multiChoiceItemLayout 0x7f0400a7 int attr nigationContentDescription 0x7f0400a8 int attr nigationIcon 0x7f0400a9 int attr nigationMode 0x7f0400aa int attr numericModifiers 0x7f0400ab int attr overlapAnchor 0x7f0400ac int attr paddingBottomNoButtons 0x7f0400ad int attr paddingEnd 0x7f0400ae int attr paddingStart 0x7f0400af int attr paddingTopNoTitle 0x7f0400b0 int attr panelBackground 0x7f0400b1 int attr panelMenuListTheme 0x7f0400b2 int attr panelMenuListWidth 0x7f0400b3 int attr popupMenuStyle 0x7f0400b4 int attr popupTheme 0x7f0400b5 int attr popupWindowStyle 0x7f0400b6 int attr preserveIconSpacing 0x7f0400b7 int attr progressBarPadding 0x7f0400b8 int attr progressBarStyle 0x7f0400b9 int attr queryBackground 0x7f0400ba int attr queryHint 0x7f0400bb int attr radioButtonStyle 0x7f0400bc int attr ratingBarStyle 0x7f0400bd int attr ratingBarStyleIndicator 0x7f0400be int attr ratingBarStyleSmall 0x7f0400bf int attr searchHintIcon 0x7f0400c0 int attr searchIcon 0x7f0400c1 int attr searchViewStyle 0x7f0400c2 int attr seekBarStyle 0x7f0400c3 int attr selectableItemBackground 0x7f0400c4 int attr selectableItemBackgroundBorderless 0x7f0400c5 int attr showAsAction 0x7f0400c6 int attr showDividers 0x7f0400c7 int attr showText 0x7f0400c8 int attr showTitle 0x7f0400c9 int attr singleChoiceItemLayout 0x7f0400ca int attr spinBars 0x7f0400cb int attr spinnerDropDownItemStyle 0x7f0400cc int attr spinnerStyle 0x7f0400cd int attr splitTrack 0x7f0400ce int attr srcCompat 0x7f0400cf int attr state_above_anchor 0x7f0400d0 int attr statusBarBackground 0x7f0400d1 int attr subMenuArrow 0x7f0400d2 int attr submitBackground 0x7f0400d3 int attr subtitle 0x7f0400d4 int attr subtitleTextAppearance 0x7f0400d5 int attr subtitleTextColor 0x7f0400d6 int attr subtitleTextStyle 0x7f0400d7 int attr suggestionRowLayout 0x7f0400d8 int attr switchMinWidth 0x7f0400d9 int attr switchPadding 0x7f0400da int attr switchStyle 0x7f0400db int attr switchTextAppearance 0x7f0400dc int attr textAllCaps 0x7f0400dd int attr textAppearanceLargePopupMenu 0x7f0400de int attr textAppearanceListItem 0x7f0400df int attr textAppearanceListItemSecondary 0x7f0400e0 int attr textAppearanceListItemSmall 0x7f0400e1 int attr textAppearancePopupMenuHeader 0x7f0400e2 int attr textAppearanceSearchResultSubtitle 0x7f0400e3 int attr textAppearanceSearchResultTitle 0x7f0400e4 int attr textAppearanceSmallPopupMenu 0x7f0400e5 int attr textColorAlertDialogListItem 0x7f0400e6 int attr textColorSearchUrl 0x7f0400e7 int attr theme 0x7f0400e8 int attr thickness 0x7f0400e9 int attr thumbTextPadding 0x7f0400ea int attr thumbTint 0x7f0400eb int attr thumbTintMode 0x7f0400ec int attr tickMark 0x7f0400ed int attr tickMarkTint 0x7f0400ee int attr tickMarkTintMode 0x7f0400ef int attr tint 0x7f0400f0 int attr tintMode 0x7f0400f1 int attr title 0x7f0400f2 int attr titleMargin 0x7f0400f3 int attr titleMarginBottom 0x7f0400f4 int attr titleMarginEnd 0x7f0400f5 int attr titleMarginStart 0x7f0400f6 int attr titleMarginTop 0x7f0400f7 int attr titleMargins 0x7f0400f8 int attr titleTextAppearance 0x7f0400f9 int attr titleTextColor 0x7f 想用这种c语言编写一个小游戏可以实现,但是非语言编写出的游戏一般的话都是比较大的,占内存比较短。 使用语言:C++使用工具:vs2019 用c++编写小程序的源代码,你可以找一个程序员用c++编写一个小程序,其实是很容易的。 1、首先打开手机输入解锁密码,并进入手机桌面。 2、其次打开《穿越火线》并进入游戏主页面。 3、后打开小程序,选择合成枪系统点击合成出红水晶ak四十七即可。 版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至836084111@qq.com 举报,一经查实,本站将立刻删除。穿越火线小程序的合成枪系统如何合成出红水晶ak四十七