![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++从入门到入坟
呆呆水獭_(:_」∠)_
这个作者很懒,什么都没留下…
展开
-
用指针方法实现对二维数组排序
方法1:#include<iostream>#include<string>using namespace std;int main(){ int m, n, i, j; cout << "请输入行数:"; cin >> m; cout << "请输入每行最大字符数:"; cin >> n; char** p = new char*[m]; cin.get(); for (i = 0; i <原创 2022-04-15 13:50:25 · 1105 阅读 · 0 评论 -
栅栏密码加密(子函数实现和有参宏实现)
分成了两个文件function.cpp#include<iostream>using namespace std;int myget(char* p)//读取原密码{ cout << "请输入原始密码,按回车结束输入!\n"; int i = 0; cin.getline(p, 100); while (p[i]!='\0')//获得密码长度 { i++; } return i - 1;}void change(char* p,int num原创 2022-04-16 18:17:28 · 527 阅读 · 0 评论 -
数组求和(c++)
#include<iostream>using namespace std;float n[1000]={0};int equalsum(float* p,int j)//求和函数{ if (j == 0) return *p; float sum = 0; sum = *p + equalsum((p + 1), j - 1); return sum;//返回和}int main(){ int i=0; cout << "输入0时,结束输入!\n.原创 2022-04-17 11:28:57 · 1641 阅读 · 0 评论 -
数组的输入输出练习
#include<iostream>using namespace std;int a[50][50];void my_cin(int* p){ cout << "这是一个50x50的int型数组,请合法输入数据(注:若所有数据一起输入,每上一行最后一个和下一行第一个要有间隔符):\n"; int i, j; for (i = 0; i < 50 ; i++) { for (j = 0; j < 50; j++) { cout <&.原创 2022-04-18 11:11:21 · 123 阅读 · 0 评论 -
递归实现随机数累乘
#include<iostream>using namespace std;double again(double sum, int n);int main(){ int n; srand((unsigned)time(NULL)); n=rand() % 10 + 1; cout << "随机数共有 " << n << " 个。\n"; cout << "这 " << n << " 个数分别为:"; .原创 2022-04-14 11:10:02 · 509 阅读 · 0 评论 -
三门课程求平均成绩
#include<iostream>using namespace std;int main(){ float a1, a2, a3; cout << "please enter the first score:"; cin >> a1; cout << "please enter the second score:"; cin >> a2; cout << "please enter the third score.原创 2022-04-21 20:03:52 · 1022 阅读 · 0 评论 -
c++实现求梯形面积
。。。so easy#include<iostream>using namespace std;int main(){ float shang = 10, xia = 20, h = 5; cout << (shang + xia) * h / 2 << endl; return 0;}原创 2022-04-13 18:58:03 · 2851 阅读 · 0 评论