- //
- #include <stdio.h>
- #include <math.h>
- int main(int argc, const char * argv[])
- {
- //不支持精确浮点运算 写不出来浮点级别的绘图运算 水平不够
- int i, j,lines;
- printf("赛睿万岁 钢厂万岁 输入一个数字把~\\n");
- scanf("%d",&lines);
- int LINES = (int) pow(lines, 2);
- for (i = -LINES; ++i <= LINES;) { // c++ sucks ~ ++c makes that work better
- for (j = -LINES; ++j<= LINES;) {
- double x = sqrt(LINES);
- printf((pow(i + x, 2) - LINES == j && i <= 0) || (pow(i - x, 2) - LINES ==-j&& i >= 0)
- ? "$" : " ");
- }
- printf("\\n");
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/3012201411422.html
来源: http://www.codesnippet.cn/detail/3012201411422.html