# Answer to Question #14576 in Action Script | Flash | Flex | ColdFusion for enjila

Question #14576
Write a C++ program with a nested loop structure that displays the sinusoidal curve f(&alpha;)=35sin() in &lsquo;*&rsquo; for f(&alpha;) &ge; 0 and in &lsquo;o&rsquo; for f(&alpha;) &lt; 0 as shown in Fig. 1. The curve starts at =0, and the sampling step-size of the curve is 0.1&pi;. You program should plot at least a full cycle (0 &le;  &le; 2&pi;)
1
2012-09-13T11:45:03-0400
#include <math.h>
#include<iostream>
using namespace std;

int main()
{
& float a,b,c,d,x,pi=3.141592;
int i,j,k;
cout<<"The sin curve is plotted below:& \n\n";

cout<<"-35 & 0 & 35\n";
& cout<<"-------------------------------------------------------------------------->";
& for (i=0;i<22;i++){
x=35*sin(2*pi*i/20);
& // cout<<x<<"\n";
& k=(int)x;
& //cout<<k<<"\n";
& for (j=-35;j<36;j++){
& if(k==j && k>0)
& cout<<"*";
& else{
if(k==j && k<0)
& cout<<"o";
& else&
& cout<<" ";
& }
& }
& cout<<"\n";
}
&
&
&
//// cin>>minNum;
// cout <<" Enter midNum: ";
//cin>>midNum;

system("PAUSE");
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!