I just started programming a few months ago and we have a project for school with the following instructions.
Read values of carModel, skidlength and roadSlope for a sequence of cases until the value of skidlength = 999 is entered, and for each case, compute the car’s speed.
b) Store the values of CarModel, Skidlength, RoadSlope and Speed as elements of arrays named carModelArray, sLengthArray, rSlopeArray and
speedArray.
c) After the value Skidlength = 999 has been entered, the algorithm must print the values, from the arrays, in the following layout:
|
| HISTORICAL DATA FROM SPEEDING CARS
| Skidlength RoadSlope Speed
| 20.10 25 26.453
|
(the numbers shown are example values)
You may specify decimal places according to your own wishes
N.B. The line is a part of the output and the decimal places of Speed,
Skidlength, and RoadSlope should be 3, 2, 0 respectively.

I don't know why but I can't seem to get the values to save in the arrays or print from it. Can some please help me? I really need it!

Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main ()
{
double pi=3.1416, brakeFactor=0.7, slopeRad, slopeTangent, speedArray[200]={0}, sum, speed, sLength, sLengthArray[200]={0};
char carModel[1000], carModelArray[200][1000];
int rSlope, count=0, rSlopeArray[200]={0},i;
while (sLength != 999)
{
printf ("Please enter the car model.\n");
scanf ("%s", &carModel);
printf ("Please enter a skid length.If 999 is entered, no calculations will be done.\n");
scanf ("%lf", &sLength);
while (sLength < 0)
{
printf ("Please enter a valid skid length.If 999 is entered, no calculations will be done\n");
scanf ("%lf", &sLength);
}
if (sLength == 999)
{
break;
}
printf ("Please enter the road slope.\n");
scanf ("%i", &rSlope);
while (rSlope<-30||rSlope>30)
{
printf ("Please enter a road slope between -30 and 30.\n");
scanf ("%i", &rSlope);
}
slopeRad = rSlope*(pi/180);
slopeTangent= sin(slopeRad)/cos(slopeRad);
speed = sqrt(30*sLength*(slopeTangent + brakeFactor));
sum = sum + speed;
count = count + 1;
for (i=0; i<count; i++)
{
sLengthArray[i]= sLength;
rSlopeArray[i]= rSlope;
strcpy(carModelArray[i],carModel);
speedArray[i]= speed;
}
}
printf ("|\n");
printf ("|\tHISTORICAL DATA FROM SPEEDING CARS\n");
printf ("|\tSkidlength\tRoadSlope\tSpeed\n");
printf ("|\t%.3lf\t%i\t\t%.2lf", sLengthArray, rSlopeArray, speedArray);
printf ("\n|\n");
system ("pause");
return 0;
}