// Project # 2
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
// Defin Variables
float N,L,TotalCost,P[71],FastWorkers;
float HourlyFastRates,FailPoorRates,FailGoodRates,RepairSlowRates;
float RepairFastRates,HourlySlowRates,Traffic,R,Md;
int row;
//Data input of case
R=1;
N=70;
L=250;
FailGoodRates=.033;
FailPoorRates=.038;
HourlyFastRates= 17.95;
HourlySlowRates= 14.00;
RepairFastRates=.40;
RepairSlowRates=.34;
FastWorkers=15;
// Math stuff
Traffic=FailGoodRates/RepairFastRates;
Md=(row*P[row])/P[row]; // <<<== After compile it gave's me debug link and
shows that this part has error.
TotalCost=(R*FastWorkers)+(Md*L);
P[0]=1;
//Data output of case
cout<<"\tMachines Down Cost\t";
cout<<Traffic;
for(row=0;row<=69;row=row+1)
{
if (row<R)
{
P[row+1]=Traffic*((N-row)/(row+1))*P[row];
}
else if (row>=R || row<=N)
{
P[row+1]=Traffic*((N-row)/R)*P[row];
The problem you've, as you're compiler probably told you(at least mine did) is that u used variables that were not initialized. in this case row is not initialized, p[row] isnt either, etc. Im not a pro so i can't say this for sure but i think it's always better to declare your variables with a default value, like = 0; or = -1;
The problem you've, as you're compiler probably told you(at least mine did) is that u used variables that were not initialized. in this case row is not initialized, p[row] isnt either, etc. Im not a pro so i can't say this for sure but i think it's always better to declare your variables with a default value, like = 0; or = -1;
When you change int row; to int row=0; as Sc2slash told you to, it builds and runs and outputs a whole bunch of numbers.
AAAA.. Thank you !!!!!
it work's!!!