Problem with functions

• 09-21-2003
lizardking3
Problem with functions
I'm having some problems with fuctions could someone please get me going in the right direction. thanks

Code:

```#include <iostream> #include <iomanip> #include <cmath> using namespace std; const int row=12, col=18; void windchill (double temp[][windspeed]); void print_wind (double n[][col]); int main() {         double temp,                 windspeed;     windchill (temp);     print_wind (windchill);         return 0; }   void windchill (double temp[],[windspeed])   {           double t,                   v,                   chill;     for ( t = 40;t <= -45;t -= 5 )                 for ( v = 5; v <= 60; v += 5)                 {                         chill = 35.74+0.6215(t)-35.75(v ^ 0.16)+0.4275(t)(v^0.16)                 }                   }                                                                                                                void print_wind (double n[][col]) {         int i,j,t,v;         cout << "\t\t    Wind Speed in MPH / Temperture in F \n\n";         for (i=0,t=40;i<col;i++,t-=5);         cout << setw(4) << t;         cout << "\n\n";         for (i=0,v=5;i<row;j++,v+=5);         {                 cout << setw(2) << v;                 for (j=0;j<col;j++)                         cout << setw(4) << n[i][j];                 cout << "\n"; } }```
• 09-21-2003
confuted
Your main problem is in passing variables to functions. If you've never used functions before, I'd strongly advise against trying to pass arrays until you understand how to pass ints and such. Have you read the tutorials here? Specifically, read "Functions" and then read "Pointers" and then "Arrays"
• 09-22-2003
lizardking3
precision
Ok i got my programm working, but the temp are still not coming out right. could someone help me in the right direction.
thanks

Code:

``` #include <iostream> #include <iomanip> #include <cmath> using namespace std; const int row=12, col=18; void windchill (double [][col]); void print_wind (double[][col]); void format(); int main() {         double windchillchart[row][col] = {0};     windchill (windchillchart);         format();     print_wind (windchillchart);         return 0; }   void windchill (double n[][col])   {                       for (int i=0,t = 40;i<row;i++,t-=5 )                 for (int j=0, v = 5; j<col;j++, v += 5)                 {                         n[i][j] = 35.75 + .6215*(t) - 35.75*(pow(v,0.16)) + .4275*(t)*(pow(v,0.16));                 }                   }                                                                                                                void print_wind (double n[][col]) {         int i,t,j,v;         cout << "\t\t    Wind Speed in MPH / Temperture in F \n\n";     cout << "  ";         for (i=0, t=40;i<col;i++,t-=5)             cout << setw(4) << t;         cout << "\n\n";         for (i=0,v=5;i<row;i++,v+=5)         {                 cout << setw(2) << v;         for (j=0;j<col;j++)                 cout << setw(4) << n[i][j];                 cout << "\n";         } } void format() {         cout << setiosflags(ios::fixed);         cout << setprecision(0); }```
• 09-22-2003
lizardking3
temp
the temps should be 36 31 25 19 13 7 1 -5
• 09-22-2003
lizardking3
row col in array
Ok the only problem i'm having now is getting the col rows correct
the temps going across the rows should be going down the cols and the temps going down should be going across the rows

could someone help me please. thanks

never mind i got it figured out. thanks anyways :( :( :D