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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:49:55+00:00 2026-05-26T12:49:55+00:00

I would like to know how to use the void function to output results

  • 0

I would like to know how to use the void function to output results based on condition. I am trying to create a windchill calculator.

What can I add to make the program below output the air temperature below speeds of 4.8kph?
What can I do to void print_result to print various statements – like “wear 3 layers” for -20 to -30 windchill (WC) or “wear 5 layers” for -30 to -40? Thanks to those who can help!

#include <iostream>
#include <cmath>
using namespace std;

bool is_cold(double V)
{
    bool is_windy;
    if (V <= 4.8)
    {
        is_windy = false;
    }
    else
        is_windy = true;
    return (is_windy);
}
int windchill_index(double T, double V)
{
    int WC;
    WC = 13.12 + 0.6215*T - 11.37*pow(V,0.16) + 0.3965*T*pow(V, 0.16);
    return (WC);
}
void print_result(double WC)
{
    cout << "From the input for tempearature and wind speed, the wind chill is: "<< WC << endl;
}

int main()
{
    double WC = 0, T = 0, V = 0;
    bool is_windy = false;
    if (!is_windy)
        {
            cout << "Please enter the air temperature in Celsius followed by the windpseed in kph: " << endl;
            cin >> T;
            cin >> V;

            is_windy = is_cold(V);
        }
    WC = windchill_index(T, V);

    print_result (WC);
    return 0;
}
  • 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-26T12:49:56+00:00Added an answer on May 26, 2026 at 12:49 pm

    Are you familiar with boolean logic operators and (&&) and or (||)? Also be sure to test at the boundary conditions (-20, -30, -40) to make sure you’re getting the results you want!

    void print_result(double WC)
    {
        cout << "From the input for tempearature and wind speed, the wind chill is: "<< WC << endl;
        if (WC <= -20 && WC > -30) {
           cout << "Wear 3 layers!" << endl;   
        } else if (WC <= -30 && WC > -40) {
           cout << "Wear 5 layers!" << endl;
        } else {
           cout << "Wear ALL the layers!" << endl;
        }
    }
    

    EDIT:: To answer your question from the comments:

    int main()
    {
        double WC = 0, T = 0, V = 0;
        bool is_windy = false;
        if (!is_windy)
            {
                cout << "Please enter the air temperature in Celsius followed by the windpseed in kph: " << endl;
                cin >> T;
                cin >> V;
    
                is_windy = is_cold(V);
            }
        //If its windy we want to calculate the windchill index, otherwise just use the ambient temp
        if (is_windy) {
           WC = windchill_index(T, V);
        } else {
           WC = T
        }
    
        print_result (WC);
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know if I can use the following JQuery function on
I would like to know how can I use tinyint in SQL Server 2005
I would like to know how can I use jQuery to select multiple items
I have a generator and I would like to know if I can use
I'm using ASP.NET MVC Preview 4 and would like to know how to use
I would like to know what kind of tool you use for writing your
I would like to know how to make use of an Axiom database resource
I would like to know what I should use to compile in C. I
I would like to know a few practical use-cases (if they are not related/tied
I would like to know, if I use WndProc in my C#.net app to

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.