- 博客(6)
- 问答 (1)
- 收藏
- 关注
原创 基于范围的for循环 for(int num : nums)
基于范围的for循环在c++11里增加了此功能,对数组的每个元素执行相同的操作。int a[5]={1,2,3,4,5};for(int x:a)cout<<x<<endl;其中,x最初表示a的第一个元素,显示第一个元素以后,不断执行循环。若要修改数组中的元素需要使用不同的循环变量语法。for(int &x:a)x *= 2;...
2022-05-08 17:26:29
2728
原创 一个三子棋小游戏
test.cmain函数的内容:int main(){ test(); return 0;}test函数为该游戏主函数,其内容为:void test(){ int in = 0;srand((unsigned int)time(NULL)); do { menu(); printf("请选择:"); scanf("%d", &in); switch (in) { case 1: game(); break; case 0:
2022-01-20 09:57:07
2952
原创 今天做了一个猜数字小游戏
#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include<math.h>#include<time.h>#include<stdlib.h>void be(){printf("*******************************\n");printf("1.开始 0.结束\n");}void cai(){int shang=100,xia=0,m=0,n;whil
2021-03-28 14:16:02
141
空空如也
stack overflow但是找不到原因
2022-03-14
TA创建的收藏夹 TA关注的收藏夹
TA关注的人