- 博客(2)
- 问答 (1)
- 收藏
- 关注
原创 C++如何用数组给一行数字排序(冒泡法)源程序附带注释
#include <stdio.h>constexpr auto N = 10;/*定义N为10*/int main(){ int i, j, temp; int a[N];/*定义数组a[N]*/ printf("请输入随机的十个数字,我将为其排序:\n"); for (i = 0; i < N; i++) { scanf_s("%d", &a[i]);/*用来接受用户输入的十个数字*/ } for ...
2022-04-27 17:10:18 1091
原创 C语言用键盘输入数字,得到该数字的平方根。
#include<stdio.h>#include<math.h>#pragma warning(disable:4996)/*C6031 返回值被忽略:"scanf"解决办法*/int main(){ float x,y; read: scanf("%f",&x); if (x < 0)goto read; y=sqrt(x); printf("the squre root of %f is %f\n",x,y)...
2022-04-16 21:19:19 3042
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人