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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:47:16+00:00 2026-06-13T04:47:16+00:00

I have two issues. 1.When I use decimals to convert, it always comes out

  • 0

I have two issues.

1.When I use decimals to convert, it always comes out as 0.

When I don’t use decimals it comes out fine.

2.I want to loop my results so that if I put let’s say 32 (start_temp) Fahrenheit I can increment it until my “Ending temperature” (end_temp) & for it to also convert the incremented, let’s say 42 if the increment was 10 from 32, then it would convert 42 Fahrenheit to it’s Celsius.

I tried doing a for loop but with no luck.

Please help?

int main()
{
    int choice;
    cout << "Please Select A Temperature Scale Conversion:\n"<< endl;
    cout << "1. Convert F to C" << endl;
    cout << "2. Convert C to F\n" << endl;
    cout << "Your Choice: ";
    cin >> choice;

    cout << "Starting Temperature: ";
    cin >> start_temp;
    cout << "Ending Temperature: ";
    cin >> end_temp;
    cout << "Temperature Increase: ";
    cin >> temp_incr;

    if (choice == 1) {
        cout << fixed << setprecision(2) << calcFahrenheit(start_temp) << endl;
    } else if (choice == 2) {
        cout << fixed << setprecision(2) << calcCelsius(start_temp) << endl;
    } else {
        cout << "You have entered an invalid option." << endl;
    }

    system("PAUSE");
    return 0;
}

float calcFahrenheit(float start_temp) {
    float f2c;
    f2c = (5.0/9.0) * (start_temp - 32.0);
    return f2c;
}

float calcCelsius(float start_temp) {
    float c2f;
    c2f = (9.0/5.0) * (start_temp + 32.0);
    return c2f;
}
  • 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-13T04:47:17+00:00Added an answer on June 13, 2026 at 4:47 am

    You can do it as keep start_temp in c2f and then calculate c2f again with that value
    inside the loop till the end_temp and increase c2f with temp_incr

    for (c2f=start_temp ; c2f<=end_temp ; c2f+=temp_incr)
     {
       // Do your calculation 
     }
    

    Same thing applies on the other formula also

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

Sidebar

Related Questions

I have two issues in this google chart. I want to either get rid
I have two machines, one is an old toshiba laptop that I use at
I have two GridViews that list out included and exclude data items respectively. By
My code works fine in a way. I have two issues with it though.
Have two issues one is showFromToolbar statement format warning issue and another is that
I am just starting out with shell scripting (sh), and I have two issues.
I have two issues with a serial program on mobile device: InputStream.available() always returns
I need to override styles for two EditText instances. I have two issues regarding
I have found many people with simliar issues but no soultions...basically I have two
I have following fiddle: http://jsfiddle.net/BFSH4/ As you see there are two issues: The h1

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.