title: A "misplaced else" error in this C++ program
body: <p>I cannot seem to fix the &quot;misplaced else&quot; error in the code below.  This code should collect and compute for term grades and give remarks depending on the score.</p>
  <pre><code>#include &lt;conio.h&gt;
  #include &lt;stdio.h&gt;
  
  main()
  {
      char name[20];
      int exam, q1, q2, q3, ass, sw, att, avgq, CS, TG;
      clrscr();
      printf(&quot;Name: &quot;);
      gets(name);
      printf(&quot;\nExam: &quot;);
      scanf(&quot;%d&quot;, &amp;exam);
      printf(&quot;\nQuiz #1: &quot;);
      scanf(&quot;%d&quot;, &amp;q1);
      printf(&quot;\nQuiz #2: );
      scanf(&quot;%d&quot;, &amp;q2);
      printf(&quot;\nQuiz #3: &quot;);
      scanf(&quot;%d&quot;, &amp;q3);
      printf(&quot;\nAssignment: &quot;);
      scanf(&quot;%d&quot;, &amp;ass);
      printf(&quot;\nSeatwotk: &quot;);
      scanf(&quot;%d&quot;, &amp;sw);
      printf(&quot;\nAttendance: &quot;);
      scanf(&quot;%d&quot;, &amp;att);
      CS = (0.4*ass) + (0.4*sw) + (0.2*att);  // class standing //
      avgq = (q1 + q2 + q3)/3;  // Average quiz //
      TG = (0.4*exam) + (0.3*avgq) + (0.3*CS);  // Term grade //
      if(TG &gt;= 90)
         printf(&quot;Term Grade: %d&quot;, TG);
         printf(&quot;Remarks: EXCELLENT&quot;);
      else if (TG&gt;=80 &amp;&amp; TG&lt;=89)
         printf(&quot;Term Grade: %d&quot;, TG);
         printf(&quot;Remarks: SATISFACTORY&quot;);
      else if (TG&gt;=76 &amp;&amp; TG&lt;=79)
         printf(&quot;Term Grade: %d&quot;, TG);
         printf(&quot;Remarks: GOOD&quot;);
      else if (TG == 75)
         printf(&quot;Term Grade: %d&quot;, TG);
         printf(&quot;Remarks: PASSING&quot;);
      else if (TG&lt;74)
         printf(&quot;Term Grade: %d&quot;, TG);
         printf(&quot;Remarks: FAILED&quot;);
      else
         printf(&quot;Invalid Input.  Try again&quot;);
      getch();
      return 0;
  }
  </code></pre>