12.19.2007

c学习笔记 tag1

今天才知道,原来link还要加 -lm, sign。。

/*
* pol_draw.c
*
* Copyright 2007 kaiyuan
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/


#include
#include

int main(int argc, char** argv)
{
double y;
int x,m,n,yy;

for(yy=0; yy<=20; yy++){
y=0.1 * yy;
m=acos(1-y)+31;
n=45 * (y-1) + 31;

for(x=0; x<=62; x++)
if(x==m && x==n)
printf("+");
else if(x==n)
printf("+");
else if(x==m || x==62-m)
printf("*");
else
printf(" ");
printf("\n");
}
return 0;
}

没有评论: