算法C++
文章平均质量分 52
Ilovegraphics
这个作者很懒,什么都没留下…
展开
-
练习9.49:如果一个字母延伸到中线之上,如d或f,则称其有上出头部 分(ascender)。如果一个字母延伸到中线之下,如p或g,则称其有下 出头部分(descender)。编写程序,读入一个单词文
【代码】练习9.49:如果一个字母延伸到中线之上,如d或f,则称其有上出头部 分(ascender)。如果一个字母延伸到中线之下,如p或g,则称其有下 出头部分(descender)。编写程序,读入一个单词文。原创 2023-09-04 12:05:30 · 59 阅读 · 0 评论 -
算法自学练习 自用(基础)
1、近似计算:PI/4,直到最后一项小于pow(10,-6); #include <iostream> #include <cmath> using namespace std; #define PI 3.1415926 int main() { float sum = 0; int n = 1; int temp; while (sum <= PI) { sum += 1.0 / n * pow(-1, n + 1);原创 2021-03-28 20:56:01 · 498 阅读 · 0 评论 -
C++谢尔夫斯基三角形递归 (代码非原创,仅自用)
1、核心思想: 基于二维数组,利用递归对数组进行相关赋值,最后打印输出。 #include <iostream> #include <cmath> #include <cstring> using namespace std; char triangle[2048][2048]; void draw(int depth,int posx,int posy){ if(depth==1){ triangle[posx][posy]='/';原创 2021-03-21 14:31:34 · 1004 阅读 · 0 评论