新手求教打印余弦函数的问题?
程序代码:
#include <iostream> #include <cmath> using namespace std; int main() { double y; int x, val; for (y = 1; y >= -1; y -= 0.1) { val = acos(y) * 10; for (x = 1; x < val; x++) cout << " "; cout << "*"; for (; x < 62 - val; x++) cout << " "; cout << "*"; } return 0; }
为什么打印出来是这个样子