herbie

herbie

  • NA
  • 14
  • 0

newbe help

Apr 5 2007 10:58 AM

How can I fix this error on this line

Operator '<' cannot be applied to operands of type 'string' and 'int'
while(sub >= 0 && Miles < distanceMiles[sub])--sub

Full code below:


using
System;

public class Miles

{

public static string GetMiles()

{

string Miles;

Console.WriteLine("Enter miles ");

Miles = Console.ReadLine();

return Miles;

}

public static void Main()

{

string Miles;

Miles = GetMiles();

int[] distanceMiles = {0, 100, 300, 500};

double[] price = {25.00, 40.00, 55.00, 70.00};

double customerMiles;

int sub = 4;

while(sub >= 0 && Miles < distanceMiles[sub])--sub;

customerMiles = price[sub];

}

}


Answers (1)