Thank you in advance et e cos 2n1000 in a program taking in

Thank you in advance! :)
e(t) e cos (2n1000) in a program, taking input for time, t. Use a constant (i.e. const for r, and use the value: 3.141592653589793238. Try test cases: (1) t-0.0, results in ve(t) 1.0 (2) t- 1.0, results in ve(t) 0.367879

Solution

#include <iostream>
#include<cmath> // We include library for Mathematical functions and transformation
const double PI=3.141592653589793238; //Here We declare the constant PI

using namespace std;

int main()
{ /*Declaration*/
double t;
double vc;
/* Declaration Ends*/

cout<<\"Input value for time\";   
cin>>t; //here we take input for t
vc= exp(-t)*cos(2*PI*1000*t); //the equation

/*exp() is a function defined as double exp(double) in cmath library*/
/*cos() is a function which takes angles in radians as parameter and returns cosine of angle in Radian*/

cout<<vc;

return 0;
}

You can refer to the comments section for the explanation of every step.

Thank you in advance! :) e(t) e cos (2n1000) in a program, taking input for time, t. Use a constant (i.e. const for r, and use the value: 3.141592653589793238.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site