Hey, I am just learning functions. I was wondering if you could tell me why this piece of code is not implementing the 'values' function.
#include <iostream>
#include <windows.h>
#include <string>
#include <iomanip>
void values(float value1[11]);
using namespace std;
float value1[11], value2[11];
int main()
{
cout << setiosflags(ios::fixed) << setprecision(2) << ios::showpoint;
float value1[11], value2[11];
char gauge[1], info;
cout << "Welcome to my program, which converts celsius into fahrenheit,\nor fahrenheit into celsius.\n\n";
do{
cout << "**********\nCelsius - c\n**********\n\n";
cout << "**********\nfahrenheit - f\n**********\n\n";
cout << "Please enter the gauge that you would like to convert: ";
cin >> info;
if((info!='c')&&(info!='f'))
{
system("cls");
cout << "You must enter 'c' or 'f'";
system("pause");
system("cls");
}
}while((info!='c')&&(info!='f'));
system("cls");
cout << "Please enter the temperature that you would like to see converted: ";
cin >> value1[5];
if(info == 'c')
{
gauge[0]='C';
gauge[1]='F';
values;
for(int x=0;x<=10;x++)
value2[x]=(value1[x]*9)/5+32;
}
else
{
gauge[0] = 'F';
gauge[1] = 'C';
values;
for(int x=0;x<=10;x++)
value2[x] = ((value1[x] - 32) * 5)/9;
}
system("cls");
cout << setw(32) << gauge[0] << " | | " << gauge[1] << endl;
cout << setw(45) << "| |" << endl;
for(int x=0;x<=4;x++)
cout << setw(32) << value1[0+x] << "-| |-" << value2[0+x] << endl;
for(int x=0;x<=5;x++)
cout << setw(32) << value1[5+x] << "-|**********|-" << value2[5+x] << endl;
cout << setw(45) << "|**********|" << endl;
cout << setw(46) << "/************\\" << endl;
cout << setw(47) << "/**************\\" << endl;
for(int x = 1; x<=5;x++)
cout << setw(48) << "|****************|" << endl;
cout << setw(47) << "\\**************/" << endl;
cout << setw(46) << "\\************/" << endl;
return 0;
}
void values(float value1[11])
{
for(int x=5;x>=1;x--)
value1[x-1] = value1[x] + 1;
for(int x=5;x<=9;x++)
value1[x+1] = value1[x] - 1;
}