编写一个在坐标轴上的,用c语言或c++写的(画出来)y=cos^2(x/2)从x的[-4π,4π]范围内的函数图,需要画有坐标轴,red panda dev c++能运行。
参考一下
https://blog.csdn.net/technologist_37/article/details/118510406?spm=1001.2014.3001.5502
#include<iostream>
#include<cmath>
using namespace std;
int main(){
double y;
int x,space;
for(y = 1;y >= -1;y -= 0.1){
//cout<<acos(y)*10<<endl;
space = acos(y)*10;
for(x = 0;x < space;x++){
cout<<" ";
}
cout<<"*";
for(;x < 62-space;x++){
cout<<" ";
}
cout<<"*"<<endl;
}
return 0;