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

  • Home
  • SEARCH
  • 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 6774887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:50:28+00:00 2026-05-26T15:50:28+00:00

could some one help. getting error with these 2 lines of code. num_red –

  • 0

could some one help. getting error with these 2 lines of code. num_red - count_red = red_pot;// all defined as 0
and

while (count_red = 0 && count_yellow = 0 && count_green = 0 && count_brown = 0 && count_blue = 0 && count_pink = 0)
        {
            if (count_black = 0)
            {
                score = score + 7;
                printf("Score: %d\n", score);
                num_balls = num_balls - 1;
            }

        }
  • 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-05-26T15:50:28+00:00Added an answer on May 26, 2026 at 3:50 pm

    If that’s a C-like language, you need to use == for equality checks, not =. The single = is for assignment so that:

    int seven = 7;
    int five = 5;
    if (seven - five == 2) ...
    

    is okay, but:

    int seven = 7;
    int five = 5;
    if (seven - five = 2) ...
    

    will, even if it compiles, not do what you expect.

    You have a classic example in your code. The segment:

    if (count_black = 0) blah;
    

    will not execute blah when count_black is zero. It will set count_black to zero and steadfastly refuse to ever execute blah, since the result of count_blah = 0 is 0 (false).


    If you want the equality:

    num_red - count_red == red_pot
    

    to be true, you need to assign one of those variables (the “unknown” one) based on the other two “known” ones. For example, if num_red and count_red are known, set red_pot with:

    red_pot = num_red - count_red;
    

    Alternatively, if red_pot and count_red are known, set num_red with:

    num_red = count_red + red_pot;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Iam getting the following error , could some one help me how to fix
I'm looking for an online introduction to occam 2. Could some one help me?
Could someone help me translate the following pseudo-code into code understood by Helicon Tech's
I've got some issues on scripting... if someone could help me, it would be
I'm some trouble finding the problem with my program. Getting the error: Use of
Googled out- could use some help here. I followed this excellent tutorial here (http://www.malteahrens.com/#/blog/howto-onenote-dev/)
I'm getting this error. Please help! Parser Error Description: An error occurred during the
Could someone help me with getting the syntax of this SQL query down? Here
I'm having some problems with getting to the object which is returned by one
I've been tasked with getting some old code working. It's dated from 2006 and

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.