Note that there are some explanatory texts on larger screens.

plurals
  1. POFour Errors In C++ Code, I Can't Find The Solutions To
    text
    copied!<p>I was looking at some code I'm working on, and there are 3-4 errors that I have tried for about a week to get rid of, and I just can't do it! I'm kind of new to programming, so if you could answer in stupid form, that would be great! Here is the code.</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; using namespace std; int main() { string password; int choice; cout &lt;&lt; "Command Line Multi-Tool" &lt;&lt; endl; cout &lt;&lt; endl; cout &lt;&lt; "plase enter your password: " &lt;&lt; endl; cin &gt;&gt; password; if (password == "creeper1") { cout &lt;&lt; endl; cout &lt;&lt; "Main Menu" &lt;&lt; endl; cout &lt;&lt; "1. Class Schedule" &lt;&lt; endl; cout &lt;&lt; "2. School Info" &lt;&lt; endl; cout &lt;&lt; "3. Exit" &lt;&lt; endl; cin &gt;&gt; choice; } else { cout &lt;&lt; "Incorrect, Access Denied" &lt;&lt; endl; return(0); } } else (password == "admin1"){ cout &lt;&lt; "/*adminLogin=='1'*/" &lt;&lt; endl; cout &lt;&lt; endl; cout &lt;&lt; "Menu::Main" &lt;&lt; endl; } return(0); } } </code></pre> <p>And here is the error log.</p> <pre><code>/Users/student/Documents/TO BE FILED/Tuesday/main.cpp:31:0 /Users/student/Documents/TO BE FILED/Tuesday/main.cpp:31: error: expected unqualified-id before 'else' /Users/student/Documents/TO BE FILED/Tuesday/main.cpp:36:0 /Users/student/Documents/TO BE FILED/Tuesday/main.cpp:36: error: expected unqualified-id before 'return' /Users/student/Documents/TO BE FILED/Tuesday/main.cpp:36:0 /Users/student/Documents/TO BE FILED/Tuesday/main.cpp:36: error: expected declaration before '}' token </code></pre> <p>Again thanks so much!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload