I need help with my C Program I am stuck

Guys I am stuck, my lecturer does not help because he said at University level the teachers aren’t responsible for actually teaching or helping anyone they are only there to lecture and its up to us to figure out everything on our own.

This is what I have so far but sadly its far from complete. I am stuck at the part where they say the parameter of cos is degrees and must be converted to radians for the C language cos () function. What do they mean by this and how am I supposed to know how to do it?

basically I don’t know how to implement the formula because if I type it as seen in the paper it will give an error.

http://oi59.tinypic.com/2qlxr4h.jpg

Here’s where you’ll want to start.

Sorry I can’t help your problem.

But doesn’t that just make you question why you’re paying all that money to go in the first place?

If you are student of some technical school then shame on you. If you are part of some humanistic studies then you should not slept at math classes few years back.

add line:

my_var =sqr(k/m)

then your formula is:

v = A * my_var * cos (my_var *t)

and check if m != 0 else you can divide by zero and it will be end of our world!

ps.
Your severe lack of logic (as for uni student) is disturbing.

I went to an ivy league school and they said the same thing all the time… Really annoying lol. especially when you’re paying out the wazoo for classes.


First, PI is already defined in math.h, its under M_PI (it should be in most compilers)

It’s really easy to convert degrees to radians, for example for degs to rads is ‘degpi/180’ and rads to degs is 'rad180/pi’


// Convert a degree to a radian
#define degToRad(angleDeg) (angleDeg * M_PI / 180)
 
// Convert a radian to a degree
#define radToDeg(angleRad) (angleRad * 180 / M_PI)


So this is what I have but still don’t know where to go from here. LOL

I am still stuck at the COS part and the g/s squared. I assume that can be written as s*s?

What I don’t get is what does cos even have to do with this formula?

#include <stdio.h>
#include <math.h>
#define degToRad(angleDeg) (angleDeg * M_PI / 180)

void main()

{

int t, m, k, a;
double v, temp, cos;

printf("Enter Time in seconds");
scanf("%d", &t);
printf(" Enter Mass in grams");
scanf("%d", &m);
printf("Enter constant in g/s");
scanf("%d", &k);
printf("Enter distance in cm");
scanf("%d", &a);



temp = sqrt(k / m);

v = a*temp*cos*(temp*t);

printf("velocity is" "%5.0f", &v);

}

I understand that degrees*PI/180 gives you radians

But what does that even have to do with this program? for cos to work with radians won’t you need a actual degree number? I dunno

Read this page. It might help you figure out what you’re doing wrong.

hey I got through with it guys seems I was super really close lol.

If your teachers don’t actually want to help you I’d reconsider the school