I am trying to create a program that converts a fahrenheit number to a celsius number, and convert a celsius number to a fahrenheit number. It takes user input and decides which sub-program to run depending on which letter is entered. Once it decides this, it asks for the number to be converted. After it has been converted, it closes the program.
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
char a = 'a';
char b = 'b';
char enter;
float enter_c_to_f;
float storage_c_to_f;
float enter_f_to_c;
float storage_f_to_c;
cout<<"If you would like to convert Fahrenheit to Celsius,\n type the lowercase letter -a- (without the hyphens).\n If you would like to convert Celsius to Fahrenheit\n type the lowercase letter -b- (without hyphens).\n You also have to make every number a\n decimal (example: 28 = 28.0)\n";
cin>> enter;
if (enter == a) {
cout<<"Enter your number (in fahrenheit) to be converted: \n";
cin>> enter_f_to_c;
storage_f_to_c = enter_f_to_c;
cout<< storage_f_to_c (((*5)/9)+32) <<;
}
(this is the first section of the program, i'm trying to figure out the first section before i move on to the second so it is less confusing). Whenever I compile this code it displays the following errors:
error: invalid type argument of unary '*' (have integer)
error: 'storage_f_to_c' cannot be used as a function
error: expected primary-expression before ';' token
All of the errors above where on line 21. Thank you in advance for the help!
P.S. I have also tried changing the code:
storage_f_to_c = enter_f_to_c;
cout<< storage_f_to_c (((*5)/9)+32)
To the code:
storage_f_to_c = enter_f_to_c (((*5)/9)+32);
cout<< storage_f_to_c <<;
It didn't work either.