title: type or namespace definition, or end of file expected; "}" expected errors
body: <pre><code>namespace Calculator
  {
      class Program
      {
          static void Main(string[] args)
          {
              Program calc = new Program();
              Program validate = new Program();
          bool valid = true;
  
          while (valid == true)
          {
              Console.WriteLine("Supported functions are *, /, +, -, ^, %.");
              Console.WriteLine("If you would like to find the greater number separate the numbers with a '?'");
              String userInput = Console.ReadLine();
              valid = validate.ValEntry(userInput);
  
              Console.WriteLine(calc.Calculate(userInput));
          }/////////////////////////////////////////////////////////////////////////
  
  
         private string Calculate(string input)
          {
          int opstringloc = findoperator(input);
          int firstval = int.Parse(input.Substring(0, opstringloc));
          int secondval = int.Parse(input.Substring(0, opstringloc));
          char operation = Convert.ToChar(input.Substring(opstringloc));
  
  
              switch (operation)
              {
                  case '+':
                      return Convert.ToString(firstval+secondval);
                      break;
                  case '-':
                      return Convert.ToString(firstval-secondval);
                      break;
                  case '/':
                      return Convert.ToString(firstval/secondval);
                      break;
                  case '*':
                      return Convert.ToString(firstval*secondval);
                      break;
                  case '%':
                      return Convert.ToString(firstval%secondval);
                      break;
                  case '^':
                      return Convert.ToString(firstval^secondval);
                      break;
                  case '?':
                      if (firstval&lt;secondval)
                      {
                          return ("[0] &lt; [1]"); Convert.ToString(firstval); Convert.ToString(secondval);
                      }
                      else if (firstval&gt;secondval)
                      {
                          return("[0] &gt; [1]"); Convert.ToString(firstval); Convert.ToString(secondval);
                      }
                      else if (firstval==secondval)
                      {
                          return ("[0] = [1]"); Convert.ToString(firstval); Convert.ToString(secondval);
                      }
                      break;
                 default:
                          return ("Invalid Entry, please try again.");
                      break;
              }
             return ("Invalid Entry, please try again.");
          }
  
      private bool ValEntry(string entry)
      {
          for (int p = 0; p &lt; entry.Length; p++)
  
  
             if (char.IsDigit(entry[p]))
             {
                 return true;
             }
              else if ((entry[p] == '+') || (entry[p] == '-') || (entry[p] == '*') || (entry[p] == '/') || (entry [p] == '%') || (entry [p] == '^') || (entry[p] == '?'))
             {
                  return true;
             }
             else
             {
                  return false;
             }
         return false;
      }
  
  
          private int findoperator (string oploc)
          {
  
              for (int loc = 0; loc &lt; oploc.Length; loc++)
              {
                if (!char.IsDigit(oploc[loc])) return loc;
              }
              return -1; 
          }
  
  
      }
  }
  } // Moving this to where it belongs shows the error in the location of the }.
  </code></pre>
  
  <p>I'm trying to create a calculator that validates user input, and then runs a calculation with the user input. The program keeps telling me that it needs a type of namespace definition or end of file expected and that I need a curly brace. I looked and each curly brace has a partner and as far as I can see it looks like all of my instances reside within the class.  I'm only two weeks into my programming courses, so please forgive me if I sound like a beginner. I've been working on this for two days and I can't figure out what I'm doing wrong. If you know what I'm doing wrong, please explain. I've put a bunch of "/" next to where the computer is telling me I need another curly brace.</p>