title: C++ error 'else' without a previous 'if'
body: <p>Im new to C++ and have been working on an assignment</p>
  
  <p>Ok so this runs, but it doesn't do the calculations
  when the window comes up I type in A B or C
  and then the length of the words
  and it just says pay=0</p>
  
  <p>here is the new code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  
  
  
  using namespace std;
  
  
  char authorLevel;
  int numberOfWords, payTotal;
  int fixedPayAmount;
  
  
  
  int main()
  {
  
  
  cout &lt;&lt; "Enter Author Level(A,B,or C):";
  char authorLevel;
  cin &gt;&gt;authorLevel;
  
  cout &lt;&lt; "Enter Length(in words):";
  int numberOfWords;
  cin &gt;&gt;numberOfWords;
  
  cout &lt;&lt; "Pay is: $" &lt;&lt; payTotal &lt;&lt; endl; 
  int payTotal;
  
  
  cout &lt;&lt; "Fixed Pay is:$" &lt;&lt; fixedPayAmount &lt;&lt; endl;
  int fixedPayAmount;
  
  //Calculations for C Level Author
  
  
  if (authorLevel == 'C')
  {
  
           //If the Number of words is &lt;7500 multiply by 0.08     
                if (numberOfWords &lt;=7500)
                    {
                      payTotal= numberOfWords * 0.08;                     
                    }
  
          //If the numberOfWords is &gt;7500 to &lt;=8000 pay is fixed 600
                  if (numberOfWords &gt;7500 || numberOfWords &lt;= 8000)
                      {
                          fixedPayAmount= 600;
  
                      }
          //If the numberOfWords is &gt;8000 to &lt;=17500 multiply by 0.075
                if (numberOfWords &gt;8000 || numberOfWords &lt;=17500)     
                      {
                      payTotal= numberOfWords * 0.075;
                      }
          //If the numberOfWords is &gt;17500 to &lt;= 19000 fixed $1313
               if (numberOfWords &gt;17500 || numberOfWords &lt;= 19000)
                      {
                          fixedPayAmount=1313;
                      }
          //If the numberOfWords is &gt;=19000 multiply 0.07
              if (numberOfWords &gt;=19000)
              {
                  payTotal= numberOfWords * 0.07;
              }
  }
  
  else if (authorLevel== 'A')
      {
  
  
           //If the Number of words is &lt;7500 multiply by 0.14     
                if (numberOfWords &lt;=7500)
                    {
                      payTotal= numberOfWords * 0.14;
                      }
  
          //If the numberOfWords is &gt;7500 to &lt;=8000 pay is fixed $1050
                  if (numberOfWords &gt;7500 || numberOfWords &lt;= 8000)
                      {
                          fixedPayAmount= 1050;
  
                      }
          //If the numberOfWords is &gt;8000 to &lt;=17500 multiply by 0.13125
                if (numberOfWords &gt;8000 || numberOfWords &lt;=17500)     
                      {                                               
                      payTotal= numberOfWords * 0.13125;
                      }
          //If the numberOfWords is &gt;17500 to &lt;= 19000 fixed $2297.75
               if (numberOfWords &gt;17500 || numberOfWords &lt;= 19000)
                      {
                          fixedPayAmount=2297.75;
                      }
          //If the numberOfWords is &gt;=19000 multiply 0.1225
              if (numberOfWords &gt;=19000)
              {
                  payTotal= numberOfWords * 0.1225;
              }
      }
  
  
  
      else if (authorLevel== 'B')
      {
  
           //If the Number of words is &lt;7500 multiply by 0.1  
                if (numberOfWords &lt;=7500)
                    {
                          payTotal= numberOfWords * 0.1;
                      }
  
          //If the numberOfWords is &gt;7500 to &lt;=8000 pay is fixed $750
                  if (numberOfWords &gt;7500 || numberOfWords &lt;= 8000)
                      {
                          fixedPayAmount= 750;
  
                      }
          //If the numberOfWords is &gt;8000 to &lt;=17500 multiply by 0.09375
                if (numberOfWords &gt;8000 || numberOfWords &lt;=17500)     
                      {
                      payTotal= numberOfWords * 0.09375;
                      }
          //If the numberOfWords is &gt;17500 to &lt;= 19000 fixed $1641.25
               if (numberOfWords &gt;17500 || numberOfWords &lt;= 19000)
                      {
                          fixedPayAmount=1641.25;
                      }
          //If the numberOfWords is &gt;=19000 multiply 0.0875
              if (numberOfWords &gt;=19000)
              {
                  payTotal= numberOfWords * 0.0875;
              }
      }
  
  
              return 0;
  }
  </code></pre>