# temperature & Wind Chill

Page 1 of 1

## 5 Replies - 254 Views - Last Post: 05 February 2018 - 07:55 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=409130&amp;s=a753398a8001d642e20910955641a95f&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 XtremeNovice

Reputation: 0
• Posts: 4
• Joined: 05-February 18

# temperature & Wind Chill

Posted 05 February 2018 - 01:58 PM

I literally started TRYING to code like last week. I am a student. Just bare with me please. And I'm not even sure what you mean by putting tags on the code but...
I'm trying to calculate this windchill given this formula, the code also converts celcius to farenheit. Eventually I'll have to put this in a loop when I figure out how to do it right.

Here are the errors. below is the code

[71] gcc -Wall lab4.c -lm
lab4.c: In function 'main':
lab4.c:28:52: error: invalid operands to binary ^ (have 'float' and 'double')
windchill = 35.74 + (0.6125 * T) - 35.75 * pow(V^0.16) + (0.4275 * T) * pow(V^0.16); //formula wont work. saying V & T first use
^
lab4.c:28:47: error: too few arguments to function 'pow'
windchill = 35.74 + (0.6125 * T) - 35.75 * pow(V^0.16) + (0.4275 * T) * pow(V^0.16); //formula wont work. saying V & T first use
^
lab4.c:28:81: error: invalid operands to binary ^ (have 'float' and 'double')
windchill = 35.74 + (0.6125 * T) - 35.75 * pow(V^0.16) + (0.4275 * T) * pow(V^0.16); //formula wont work. saying V & T first use
^
lab4.c:28:76: error: too few arguments to function 'pow'
windchill = 35.74 + (0.6125 * T) - 35.75 * pow(V^0.16) + (0.4275 * T) * pow(V^0.16); //formula wont work. saying V & T first use
^
lab4.c:12:8: warning: variable 'windchill' set but not used [-Wunused-but-set-variable]
float windchill;
^
:~/101/lab/lab4 [72]

```#include <stdio.h>
#include <math.h>

int main (void) {

float celsius;
int farenheit;
int wind;                        //does this need a seperate declaration?
float windchill;
float V, T;                 //does this need to be declared separately? does it need initialization

fprintf(stdout, " What is the temperature (degrees farenheit)?\n");
fscanf(stdin, "%i", &farenheit);

celsius = (farenheit - 32.0) * 5.0 / 9.0;

fprintf(stdout, "%6d degrees F = ", farenheit);
fprintf(stdout, "%6.2f", celsius);
fprintf(stdout, " degrees C \n\n ");

fprintf(stdout, "Enter a value for wind in MPH\n");
fscanf(stdin, "%6f", &V); //is this supposed to say wind or V?

windchill = 35.74 + (0.6125 * T) - 35.75 * pow(V^0.16) + (0.4275 * T) * pow(V^0.16); //formula wont work. saying V & T first use
// also saying too few arguments, when arguments inserted. no effect

fprintf(stdout, " The windchill for %6d farenheit at %6d mph winds is ___", farenheit, wind); // dashed line because I'm not
// sure what to put there yet
return 0;

```

Is This A Good Question/Topic? 0

## Replies To: temperature & Wind Chill

### #2 modi123_1

• Suitor #2

Reputation: 13763
• Posts: 54,941
• Joined: 12-June 08

## Re: temperature & Wind Chill

Posted 05 February 2018 - 02:01 PM

Quote

lab4.c:28:76: error: too few arguments to function 'pow'

Look at the parameters for 'pow'. That doesn't match what you have.
http://www.cplusplus...ence/cmath/pow/

### #3 XtremeNovice

Reputation: 0
• Posts: 4
• Joined: 05-February 18

## Re: temperature & Wind Chill

Posted 05 February 2018 - 02:07 PM

When I did that, it told me that the left hand side had no effect. It wasn't in a printf statement though.

This post has been edited by ndc85430: 05 February 2018 - 10:14 PM
Reason for edit:: Removed quote of previous post. Please just press "Reply" in future.

### #4 modi123_1

• Suitor #2

Reputation: 13763
• Posts: 54,941
• Joined: 12-June 08

## Re: temperature & Wind Chill

Posted 05 February 2018 - 02:29 PM

```pow(V^0.16)
```

This is only one parameter. Per the docs it needs two.

```double pow (double base, double exponent);
```

### #5 XtremeNovice

Reputation: 0
• Posts: 4
• Joined: 05-February 18

## Re: temperature & Wind Chill

Posted 05 February 2018 - 07:45 PM

I got it working now. thank you

### #6 tony jay

Reputation: 18
• Posts: 46
• Joined: 31-January 18

## Re: temperature & Wind Chill

Posted 05 February 2018 - 07:55 PM

Good man!