Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

using System;
using static System.Console;
using System.Globalization;
class MoveEstimator
{
   static void Main()
   {
     string entry; 
     int base;
     base = 200;
     int rph = 150;
     int rpm = 2;
     int input;
     int hours; 
     int miles; 
     int total;
     
     WriteLine ("Enter number of hours for job >>");
     entry = ReadLine ();
     WriteLine ("Enter number of miles for job >>");
     string entryii = ReadLine ();

     hours = Convert.ToInt32(entry);
     miles = Convert.ToInt32(entryii);

     total = (base + rph*hours + rpm*miles);

  WriteLine ("For a move taking{0} hours and going {1}miles the estimate is {2}",hours,miles,total.ToString("C", CultureInfo.GetCultureInfo("en-US")));
     


   }
}

I keep getting a error saying that my integer variable "base" is a unexpected symbol. all i did is say int base;. how its that wrong. I am also getting a error for every time I reference it.

question from:https://stackoverflow.com/questions/66066950/unexpected-symbol-error-for-my-int-varible

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
202 views
Welcome To Ask or Share your Answers For Others

1 Answer

First of all, welcome to the Stack Overflow!

base is a reserved keyword in C#, so you should give this variable any other name, for example initialDistance))


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...