【古典例題】出力cos図
868 ワード
プログラム:
体得:一見全然分からないが、理解してからでないと分からない...天の外に天がある
/*
Copyright (c) 2013,
* All rights reserved.
* :
* :2013 1 14
* :v1.0
* : “*” 0~360 sin(x)
* :
* : 100
* :
* : ,0 180 ,180 360 。Y -1 1, 20 , 0.1。X :m=acos(y)
* , “*” 。
* :
*/
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
double y;
int x,m;
for(y=1;y>=-1;y-=0.1) //y , 1 -1, 0.1
{
m=acos(y)*10; // y m, 10
for(x=1;x<m;x++)
cout<<" ";
cout<<"*"; // *
for(;x<62-m;x++) // 32
cout<<" ";
cout<<"*
"; // *
}
return 0;
}
体得:一見全然分からないが、理解してからでないと分からない...天の外に天がある