#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#define pi 3.1416
#define brkFactor 0.7
int readVal(int skidLength, int roadSlope);
int main()
{
double slopeRad,slopeTan,roadSlope,skidLength=-1,speedCar,all[20];
char carModel[200];
int readVal(double skidLength, double roadSlope);
slopeRad = roadSlope*(pi/180);
slopeTan= sin(slopeRad)/ cos(slopeRad);
speedCar = sqrt(30*skidLength*(slopeTan+brkFactor));
printf("The %s has a speed of %.2lf kmh \n",carModel,speedCar);
system("pause");
return 0;
}
int readVal(double skidLength, double roadSlope,char carModel[200], int all[20])
{
printf("Enter the name of the car model\n");
scanf("%s%s",carModel);
printf("Enter the skid length\n");
scanf("%d",&skidLength);
skidLength = all[0];
while(skidLength<=0||skidLength==999 ){
printf("Enter a value above zero and not equal to 999\n");
scanf("%d",&skidLength);
skidLength = all[0];
}
printf("Enter the roadSlope\n");
scanf("%d",&roadSlope);
roadSlope = all[1];
while (roadSlope<=-30||roadSlope>30){
printf("Enter a value between -30 and 30\n");
scanf("%d",&roadSlope);
roadSlope = all[1];
}
return all[20];
return 0;
}
Linking modules help!!!!!!!
Started by russian777, Nov 26 2008 04:23 PM
3 replies to this topic
#1
Posted 26 November 2008 - 04:23 PM
So yeah need some serious help !!!!!!!! its just doesn't run at all , despite compiling. Gonna need some help on this one ppl . Not to be a prick but the single lined answer genuinely dont help as much as they tend to be complicated answers that i jus really cant understand due to inexperience.
|
|
|
#2
Posted 26 November 2008 - 04:44 PM
russian777 said:
So yeah need some serious help !!!!!!!! its just doesn't run at all , despite compiling. Gonna need some help on this one ppl . Not to be a prick but the single lined answer genuinely dont help as much as they tend to be complicated answers that i jus really cant understand due to inexperience.
Well. I gave you a strict answer in you previous post, and you don't even thank or post feedback in any way.
I've just noticed that J-Camz has the same problem, so this seams like homework. The best way to help you is not by doing the examples, but to give you complicated answers to make you think.
Either way here's my help:http://forum.codecal...elp-arrays.html
Maybe if I knew what it is that you need help, I will be more helpful. You don't ask for complicated answers but you complicate whoever want's to help you by just posting the code and not any specific question.
Have a look at kpgen at sourceforge
Neither Emacs or Vi are my primary editors...
..and I'm not ashamed!!!
Neither Emacs or Vi are my primary editors...
..and I'm not ashamed!!!
#3
Posted 26 November 2008 - 05:30 PM
lol o man...sorry as in i genuinely appreciate the help i receive on the forum
#4
Posted 26 November 2008 - 05:36 PM
It runs just fine, the problem is that instead of calling readVal inside main, you declared a local function that is ALSO called readVal. It's simply running against random data.


Sign In
Create Account


Back to top









