i spent a long time trying to fix this probably somthing stupid but please help me.
i dont see any problem but its probably somthing stupid.
it compiles ok and when i run it it works until i get to the equations it prints somthing like
1.62111e-307 here is my code i dont know why but it posted when i pressed the space bar.
#include <stdlib.h>
#include <iostream>
#include <conio.h>
#include <math.h>
#include <stdio.h>
#include <cstdio>
#include <fstream>
using namespace std;
int main()
{
system("COLOR 5");
system("TITLE tempature converter");
double firstNumber, answer;
char f, c, k, operation, repeat, form;
char *tempatures;
do
{
cout <<"\n\n\n\t \t \t \tINSTRUCTIONS \n \n First enter the number you will start with, then the form the number is in \n and lastly the form you want to convert to. \n \n c = celsius \n k = kalvin \n f = fahrenheit";
cout <<"\n \n \n \n Enter the number you will start with: ";
cin >> firstNumber;
cout <<"\n Enter the form of the number you have (c/f/k): ";
cin >> form;
cout <<"\n Now enter c, f, or k for what you want to convert to: ";
cin >> operation;
if (form == 'f') {
if (operation == 'c'){
cout <<"\n The answer is: ";
answer == ((firstNumber - 32) * 5 / 9);
cout << answer;
}
if (operation == 'k'){
cout <<"\n The answer is: ";
answer == ((firstNumber - 32) * 5/9 + 273.15);
cout << answer;
}
if (operation == 'f'){
cout <<"\n The answer is: ";
answer == firstNumber;
cout << answer;
}
}
if (form == 'c') {
if (operation == 'c'){
cout <<"\n The answer is: ";
answer == firstNumber;
cout << answer;
}
if (operation == 'f'){
cout <<"\n The answer is: ";
answer == (firstNumber * 9 / 5 + 32);
cout << answer;
}
if (operation == 'k'){
cout <<"\n The answer is: ";
answer == (firstNumber + 273.15);
cout << answer;
}
}
if (form == 'k') {
if (operation == 'k'){
cout <<"\n The answer is: ";
answer == firstNumber;
cout << answer;
}
if (operation == 'c'){
cout <<"\n The answer is: ";
answer == (firstNumber - 273.15);
cout << answer;
}
if (operation == 'f'){
cout <<"\n The answer is: ";
answer ==((firstNumber - 273.15) * 9/5 + 32); //k - f
cout << answer;
}
if (!c,f,k)
cout <<"\n that wasn't c, f or k";
}
ofstream tempature(tempatures, ios::app);
tempature << form << operation << answer;
cout <<"\n \n \n \t Do you want to convert another number (y,n): ";
cin >> repeat;
if (repeat == 'y'){
system("CLS");
}
}
while (repeat == 'y');
}
ps: i probably have some usless headers in there because of other stuff i was doing that didnt work.:)