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 7604421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:54:18+00:00 2026-05-30T23:54:18+00:00

For below code, when input is: first input = 0 1 2 3 4

  • 0

For below code, when input is:

first input = 0 1 2 3 4 5 6 7 8 9

second input = 1 2 3 4 5 6 7 8 9 10

it will produce output of:

first output = 0

second output = 1

instead of taking each input quartile it take its first element, and the problem is (after testing and such), it follow with the problem in code

for (vector<int>::size_type counter = 0; (quartiles < quadro) && (counter < numstore.size()); ++counter)
{
    if (counter == (quartiles/quadro * numstore.size()))
    {
        quaele.push_back(numstore[counter]);
        if ((quartiles == 2) && (numstore.size() / 2 == 0))
            quaele[quartiles-1] = (numstore[counter]+numstore[counter-1]) / 2;
        ++quartiles;
    }
    // test
    cout << quartiles;
}

where the conditional in “if function” doesn’t work, I mean on first loop, counter == 0, how can 0 == 1(quartiles)/4(quadro) * 10(numstore.size()??

  • 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-30T23:54:19+00:00Added an answer on May 30, 2026 at 11:54 pm

    Because quartiles and quadro are both integers and the first is always less than the second (because that’s what the for statement says), the expression:

    quartiles / quadro * numstore.size()
    

    will always be equal to zero, because quartiles / quadro is calculated first. Hence, the if statement will only ever be true the first time through the loop.

    You may be able to get around this by re-arranging the calculation:

    quartiles * numstore.size() / quadro
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code below produces an error saying that my input string was not in
For the code below, My input's are as following: score Bob 10 score Jill
This code below works in all web browsers except IE: <input type="text" name="passwordLogin" value="Password"
I have below html code in my aspx. <input type=hidden id=medicalLink value='<a href=/forms/contactus.aspx >Contact
I want to know if the code below removes all input type='text' values back
I currently use the following code to position a div directly below an input
I started with the first code snippet below to search a list of lines
I placed all code below. My page works like that Page's first scene When
Below code saying error incorreect syntax near Main INSERT INTO tbl ( 'Week', Main,
below code is my databasehandler class i got it from a tutorial. Beside that

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.