C的浪漫-用C画爱心
#C的浪漫-用C画爱心static/image/hrline/5.gif
#include <stdio.h>
#include <windows.h>
int main(){
float a,x,y;
for(y=1.5f;y>-1.5f;y-=0.1f){
for(x=-1.5f;x<1.5f;x+=0.05f){
a=x*x+y*y-1;
char ch=a*a*a-x*x*y*y*y<0.0f?'*':' ';
putchar(ch);
}
printf("发财 ");
printf("被爱 ");
printf("好运 ");
printf("常在 ");
Sleep(100);
printf("\n");
}
getchar();
return 0;
}
Angels〃欧豪 发表于 2022-1-25 14:53
Compilation failed due to following error(s).
2 | #include
| ^~~~~~~~~ ...
什么编译器,mingw是默认支持windows.h的。这个源代码只能在windows平台上跑,如果编译不通过,将windows.h改为Windows.h尝试,linux平台删除windows.h,删除sleep语句,同样可以编译 本帖最后由 Angels〃欧豪 于 2022-1-25 14:54 编辑
Compilation failed due to following error(s).
2 | #include <windows.h>
| ^~~~~~~~~~~
compilation terminated. 要是能再解读一下俩个for循环,那就太好了:loveliness: dinglz 发表于 2022-1-28 14:33
什么编译器,mingw是默认支持windows.h的。这个源代码只能在windows平台上跑,如果编译不通过,将windows ...
后来我拿到Windows平台下通过了,平台环境的锅。。。
页:
[1]