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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:58:41+00:00 2026-05-23T11:58:41+00:00

I am having issues with my program displaying information from different if statements when

  • 0

I am having issues with my program displaying information from different if statements when they shouldn’t be.
http://i53.tinypic.com/1zyx68.png

#include <iostream>
#include <string>
using namespace std;
int main( )
{
    string smreturn = "";
    string jointsingle = "";
    double income = 0.00;
double taxedincome = 0.00;
{
cout << "\nPlease enter your taxable income: ";
cin >> income;
while (income <= 0)
{
    cout << "\n Please enter a valid positive taxable income: ";
    cin >> income;
}
cout << "\n";
cout << "\nPlease press m if married and filing for a joint return, or s if filing for a single return: ";
cin >> smreturn;
            while (!(smreturn =="m") && !(smreturn =="M") && !(smreturn =="s") && !(smreturn =="S"))
{
    cout << "\nPlease press m if married and filing for a joint return,\n or s if filing for a single return: ";
    cin >> smreturn;
}

if (smreturn == "m" || "M")
{
    if (income >= 0 && income <= 1726)
    {
        taxedincome = income * .023;
    }
    if (income >= 1727 && income <= 3450)
    {
        taxedincome = (income - 1727) * .033 + 40;
    }
    if (income >= 3451 && income <= 5176)
    {
        taxedincome = (income - 3450) * .042 + 97;
    }
    if (income >= 5177 && income <= 6900)
    {
        taxedincome = (income - 5176) * .052 + 169;
    }
    if (income > 8626)
    {
        taxedincome = (income - 8626) * .07 + 362;
    }
        cout << "\nYour taxable income is:$" << (income);
cout << "\nAnd you are filing a joint return";
cout << "\nYour income tax will be:$" << (taxedincome);
cout << "\n";

}
if (smreturn == "s"||"S")
{
    if (income >= 0 && income <= 863)
    {
        taxedincome = (income * .023);
    }
    if (income >= 864 && income <= 1726)
    {
        taxedincome = (income - 863) * .033 + 20;
    }
    if (income >= 1727 && income <= 2588)
    {
        taxedincome = (income - 1726) * .042 + 48;
    }
    if (income >= 2589 && income <= 3450)
    {
        taxedincome - (income - 2588) * 0.052 + 85;
    }
    if (income >= 3451 && income <= 4313)
    {
        taxedincome - (income - 3450) * 0.06 + 129;
    }
    if (income > 4313)
        {
            taxedincome - (income - 4313) * 0.07 + 181;
}
        cout << "\nYour taxable income is:$" << (income);
cout << "\nAnd you are filing a single return";
cout << "\nYour income tax will be:$" << (taxedincome);
cout << "\n";
}
}           cout << "\n";
string returninfo;
if (smreturn == "s" || "S")
{
    returninfo == "single return";
}
else
{
    returninfo == "joint return";
}

system("PAUSE");
return 0;
}

It is displaying the info from both If statements, saving taxedincome as a single return for a joint return.

  • 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-23T11:58:42+00:00Added an answer on May 23, 2026 at 11:58 am
    if (smreturn == "m" || "M")
    

    should be

    if ( (smreturn == "m") || (smreturn == "M") )
    

    And mistakes like these in few other conditions. If you need to compare, you need to repeat it for each identifier in the if condition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a plug-in for another program in C#.NET, and am having performance issues
Having issues referencing $(this) from within a the nested ajax 'success' function... I know
I'm having issues requiring 'digest/sha1' . ~$ ./configure --prefix=$HOME/usr --program-suffix=19 --enable-shared ~$ make ~$
I'm having issues with Unicode characters in Perl. When I receive data in from
I am having issues with the dojox mobile textbox in my program. The box
I am having some issues with a program I am writing in C, and
I am having issues with usage of log10f(). I am compiling the program on
I keep getting an error when trying to compile my program, i'm having issues
I am having some issues with a small program I have made that edits
So I'm having issues with my program. Basically this far the program is like

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.