![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
杂学
Zsprinkle
这个作者很懒,什么都没留下…
展开
-
数字转为字符串(代码注释超详细)
int的范围是-2147483648到+2147483648之间,共11位,即(正负21亿之间)将int分为三种情况:0负数正数#include <iostream>#include <cstring>#include <cstdio>#include <stack>using namespace std;char* myitoa(int num){ //1.内存分配必须在堆上,否则局部变量失效 //2.字符串的末原创 2021-01-27 00:22:24 · 4689 阅读 · 0 评论 -
曼哈顿距离
例 编写程序,输入一个n,打印n阶菱形,n是奇数 如,当n = 9时,输出以下图形: 首先,简单介绍一下什么是曼哈顿距离:两点间的曼哈顿距离 = | x1 - x2 | + | y1 - y2 |区分:两点间的距离为sqrt( (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) )分析:通过上图可以看出,要...原创 2020-04-22 18:12:02 · 6090 阅读 · 4 评论