Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8721331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:12:15+00:00 2026-06-13T07:12:15+00:00

Okay I know this is more text than you want but I literally cannot

  • 0

Okay I know this is more text than you want but I literally cannot find the problem in the following code

#include <iostream>
using namespace std ;

int main(void)
{
   int score1, score2;

   PrintInfo() ;

   score1 = GetScore(); //  Call function GetScore, to obtain a value for score1.

   if (RangeError()) ;  //  IF score1 is out of range, print an error message.
   {
       cout << "Sorry you entered an invalid score." << endl ;
   }
   else  // THIS IS LINE 46, THIS IS THE ELSE IT IS TALKING ABOUT
   {
       score2 = Getscore ; // Call GetScore a second time, to obtain a value for score2.

       if (RangeError ()); // IF score2 is out of range, print an error message.
       {
           cout << "Sorry you entered an invalid score." << endl ;
       }
       else  // ELSE, using a call to function maximum within a cout
       {     // statement, print the maximum score.
           cout << maximum() << endl ;
       }
   }

    return 0;
}

There’s a lot in there, I know, but the main problem seems to be around my second else. For whatever reason I keep getting the following errors:

lab05a.cpp:46: error: expected `}’ before ‘else’

lab05a.cpp: At global scope:

lab05a.cpp:46: error: expected unqualified-id before ‘else’

I know it’s something to do with bracketing but I can’t find any problems! Also: I apologize for the lack of line numbers, we are not using an editor that allows them. I could have added them, but I removed a lot of irrelevant text for brevity and adding them on would not have given them the proper line number for the error. As such I will show where line 46 is. I removed most of the declarations since the problem does not seem to lie therein. Please help me, this is the first time I’ve ever had a problem I couldn’t solve on my own.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:12:16+00:00Added an answer on June 13, 2026 at 7:12 am
    if (RangeError()) ;
    {
    

    should be

    if (RangeError())
    {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, I know it is weird but when I put this code between <head
Okay, now this is more a rant about Linux than a question, but maybe
Okay, I know this is a Noob question but I cant see to get
Okay so I'm struggling more than I should with this. I've been to the
Okay, I know this question have been asked plenty of times already, but I
Okay well I apologize for how sloppy this code is, but I still cant
Okay i know this has been asked a lot but it seems that none
Okay; sorry I know this isn't a programming question as such, but it was
Okay so I know the title is very vague but here is my more
I know this is already a pointer, but I want to understand what this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.