View Single Post
Old 09-28-2005, 01:30 AM   #3 (permalink)
subodhgupta1
Registered User
 
Join Date: Sep 2005
Posts: 24
subodhgupta1 is on a distinguished road
I get an incorrect answer

I get an incorrect answer may be due to the following reason:

cout << "Please enter the distance (miles): ";
cin >> distance;
while(distance < 10 || distance > 3000)
{
cout<<"Please enter the distance above 10.0 and below or equal to 3000.0: ";
cin>>distance;
}

if (distance<=500.0){
dist_const=1.0;
}else
if (distance<=1000.0){
dist_const=2.0;
}else
if (distance<=1500.0){
dist_const=3.0;
}else
if (distance<=2000.0){
dist_const=4.0;
}else
if (distance<=2500.0){
dist_const=5.0;
}else
if (distance<=3000.0){
dist_const=6.0;
}
subodhgupta1 is offline   Reply With Quote