- #1
mathman44
- 207
- 0
Homework Statement
I have an assignment to make a C++ program (I've never seen C++ before, and my professor has never taught it) that makes a set of displacement values corresponding to the motion of a damped oscillator. The function is:
[tex]x = A*e^{(-\gamma*t/2)} * cos(\omega*t)[/tex]
where variables are to "float", except time. Time should be defined as "int" and use it as a counter variable. [tex]\gamma[/tex] and [tex]\omega[/tex] are to be defined arbitrarily. For each time value, print out the time and the displacement.
I have absolutely no background with C++. After googling for some time, I downloaded Code::Blocks and now I have to write the file. I have never seen C++ before... so I feel kind of bad for not showing any work, but I literally have no idea how to do this. This is all I have:
#include <stdio.h>
main()
{
int time;
int lower, upper, step;
lower = 0;
upper = 300;
step = 1;
Would anyone be kind enough to lend me some hints or give me a template?