- 博客(16)
- 收藏
- 关注
原创 2048游戏源代码
#define _CRT_SECURE_NO_DEPRECATE#define _CRT_NONSTDC_NO_DEPRECATE#include<iostream>#include<ctime>#include <conio.h>#include <iomanip>using namespace std;class Game { static const int N = 5; int chessboard[N][N] = { 0 };
2020-12-27 17:31:56 1851
原创 第3次上机第2题
#include<iostream>#include<vector>using namespace std;void shunxufind(int a[] , int x );//顺序查找法函数声明void zhebanfind(int b[], int n,int key);//折半查找法函数声明bool sushufind(int p);//判断素数函数声明void mysort(vector<int>& c, int n);//冒泡函数声明in
2020-12-24 17:44:20 86 1
原创 第2次上机第4题
using namespace std;int main() { int n,k=0,x=0,y=0; cout << "请随机输入一个数作为n" << endl; cin >> n; int m = rand() % n; vector<int>a; for (int i = 0; i <= n; i++) { a.push_back(i); } for (; x <= n - 1;y++) { if (a[y]
2020-12-11 11:07:12 86
原创 2020-12-10
#include <iostream>#include<string>#include<vector>using namespace std;int main(){ string a; int is_palindrome = 1; cout << "Please input a string .." << endl; cin >> a; int i = a.length(); vector<int>b
2020-12-10 17:21:20 167
原创 第2次上机第1题
#include<iostream>using namespace std;int main(){ int a=0,b=0,c=0, s; int arr[3][4]{ {1,2,3,4}, {5,6,7,8}, {9,10,11,12}}; for (int j = 0; j <= 3; j++) { a+= arr[0][j]; } for (int j = 0; j <= 3; j++) { b += a
2020-12-10 14:17:39 51
原创 第2次上机第2题
#include<iostream>using namespace std;int main() { int a=0, b=0, c=0; int a2d[3][3]{ {2,4,3}, {3,4,6}, {8,7,9} }; int(*p)[3] = a2d; for (int x = 0; x <= 2;x++) { a += *(*(p + x)+1);} cout << "主对角线上元素和等于" << a <&
2020-12-10 14:16:03 69
原创 第10题
#include<iostream>using namespace std;int main() { int n; cout << "请输入一个正整数"; cin >> n; for (int i = 1; i <= n; i++) { for (int j = 1; j <= 30; j++) cout << ' '; for (int j = 1; j <= n - 2 * i; j++) cout &l
2020-11-13 21:33:32 69
原创 第9题
#include<iostream>using namespace std;int main() { int i = 100, j, m = 0; do { for (j = 2; j < i; j++) { if (i%j == 0) { break; } if (i == j + 1) { cout << i << ' '; m++; if (m % 5 == 0)cout <<
2020-11-13 20:15:23 62
原创 第8题
#include<iostream>using namespace std;int main() { int a,b; cout << "请随机输入1个数"; cin >> a; for (b = 2; b <= a; b++) { if (a%b == 0) break; } if (a == b)cout << "该数是素数" << endl; else cout << "该数不是素数" &
2020-11-13 20:14:30 47
原创 第7题
#include<iostream>using namespace std;int main(){ float pi = 3.1415936535; int radius=1, area=0; do { area = radius * radius*pi; radius++; cout << area << endl; } while (area <= 100); return 0;}
2020-11-13 20:13:51 106
原创 第6题
#include<iostream>using namespace std;int main() { double a, b, c, d, e, f, g, h, i, j,k=0,m; cout << "请随机输入10个数"; cin >> a >> b >> c >> d >> e >> f >> g >> h >> i >> j; if (a &g
2020-11-13 20:13:11 89
原创 第5题
#include<iostream>using namespace std;int main() { int a = 1, b = 2, c = 3, d = 4; for (; a <= 5, b <= 10, c <= 15, d <= 20; a += 1, b += 2, c += 3, d += 4) { cout << a<<" " << b <<" " << c <&.
2020-11-13 20:12:12 51
原创 第4题
#include<iostream>using namespace std;int main() { int N, s; for (;;) { cout << "请输入1个数"; cin >> N; if (N >= 0) { s = N * (N + 1) / 2; cout << s; } } return 0;}
2020-11-13 20:10:56 132
原创 第3题
#include<iostream>using namespace std;double num;int main() { for (int a = 1; a <= 9; a++) { for (int b = 0; b <= 9; b++) { for (int c = 0; c <= 9; c++) { num = 100 * a + 10 * b + c; if (num == a * a*a + b * b*b + c *
2020-11-13 20:10:18 152
原创 第2题
#include<iostream>#include<cmath>using namespace std;double x, y, z, p, s;int main() { cout << "请输入三角形的三条边"; cin >> x >> y >> z; double p = (x + y + z) / 2; double k = p * (p - x)*(p - y)*(p - z); s = sqrt(k);
2020-11-13 20:09:22 62
原创 第一题
这是你第一次使用 Markdown编辑器 所展示的欢迎页。如果你想学习如何使用Markdown编辑器, 可以仔细阅读这篇文章,了解一下Markdown的基本语法知识。新的改变我们对Markdown编辑器进行了一些功能拓展与语法支持,除了标准的Markdown编辑器功能,我们增加了如下几点新功能,帮助你用它写博客:全新的界面设计 ,将会带来全新的写作体验;在创作中心设置你喜爱的代码高亮样式,Markdown 将代码片显示选择的高亮样式 进行展示;增加了 图片拖拽 功能,你可以将本地的图片直接拖拽到
2020-11-13 20:07:19 194
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人