Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <cstdlib>
- #include <math.h>
- #include <ctime>
- using namespace std;
- int main(void)
- {
- string choice;
- string choice2;
- float temp = 0.0;
- float temp2 = -273.15;
- bool looping = true;
- while (looping == true)
- {
- cout << "Temperature Converter V1.1\n\n";
- cout << "1.) Farenheit to Celsius Converter\n";
- cout << "2.) Farenheit to Kelvin Converter\n";
- cout << "3.) Celsius to Farenheit Converter\n";
- cout << "4.) Celsius to Kelvin Converter\n";
- cout << "0.) Exit\n";
- cout << "> ";
- cin >> choice;
- system("clear");
- if (choice == "1") {
- cout << "Temperature Converter V1.1:\n";
- cout << "Farenheit to Celsius Converter\n\n";
- cout << "What is the temperature in Farenheit: ";
- cin >> temp;
- temp = (temp - 32) * 5/9;
- system("clear");
- cout << "Temperature Converter V1.1:\n";
- cout << "Farenheit to Celsius Converter\n\n";
- cout << "The temperature is " << temp << " degrees Celsius." << "\n\n";
- cout << "1.) Return to Main Menu\n";
- cout << "2.) Exit Program\n";
- cout << "> ";
- cin >> choice;
- while (looping == true)
- {
- if (choice == "1") // check that later
- {
- system("clear");
- break;
- }
- if (choice == "2")
- {
- cout << "\nExiting Program...";
- looping = false;
- }
- else
- {
- system("clear");
- cout << "Unknown option: (" << choice << ")\n"
- << "Available Options: 1 & 2\n\nReverted back to Main Menu.\n"
- << "Bug is still being worked out. Thank you for your patience.\n\n";
- break;
- }
- }
- }
- else if (choice == "2")
- {
- cout << "Temperature Converter V1.1:\n";
- cout << "Farenheit to Kelvin Converter\n\n";
- cout << "What is the temperature in Farenheit: ";
- cin >> temp;
- temp = (temp - 32) * 5/9;
- temp = temp + 273.15;
- system("clear");
- cout << "Temperature Converter V1.1:\n";
- cout << "Farenheit to Kelvin Converter\n\n";
- cout << "The temperature is " << temp << " degrees Kelvin." << "\n" << endl;
- cout << "1.) Return to Main Menu\n";
- cout << "2.) Exit Program\n";
- cout << "> ";
- cin >> choice;
- while (looping == true)
- {
- if (choice == "1") // check that later
- {
- system("clear");
- break;
- }
- if (choice == "2")
- {
- cout << "\nExiting Program...";
- looping = false;
- }
- else
- {
- system("clear");
- cout << "Unknown option: (" << choice << ")\n"
- << "Available Options: 1 & 2\n\nReverted back to Main Menu.\n"
- << "Bug is still being worked out. Thank you for your patience.\n\n";
- break;
- }
- }
- }
- else if (choice == "3")
- {
- cout << "Temperature Converter V1.1:\n";
- cout << "Celsius to Farenheit Converter\n\n";
- cout << "What is the temperature in Celsius: ";
- cin >> temp;
- temp = temp * 9/5 + 32;
- system ("clear");
- cout << "Temperature Converter V1.1:\n";
- cout << "Celsius to Farenheit Converter\n\n";
- cout << "The temperature is " << temp << " degrees Farenheit." << "\n" << endl;
- cout << "1.) Return to Main Menu\n";
- cout << "2.) Exit Program\n";
- cout << "> ";
- cin >> choice;
- while (looping == true)
- {
- if (choice == "1") // check that later
- {
- system("clear");
- break;
- }
- if (choice == "2")
- {
- cout << "\nExiting Program...";
- looping = false;
- }
- else
- {
- system("clear");
- cout << "Unknown option: (" << choice << ")\n"
- << "Available Options: 1 & 2\n\nReverted back to Main Menu.\n"
- << "Bug is still being worked out. Thank you for your patience.\n\n";
- break;
- }
- }
- }
- else if (choice == "4")
- {
- cout << "Temperature Converter V1.1:\n";
- cout << "Celsius to Kelvin Converter\n\n";
- cout << "What is the temperature in Celsius: ";
- cin >> temp;
- temp = temp + 273.15;
- temp = round(temp);
- system ("clear");
- if (temp == temp2 )
- {
- cout << "The temperature is 0 degrees Kelvin." << "\n" << endl;
- }
- else
- {
- cout << "Temperature Converter V1.1:\n";
- cout << "Celsius to Kelvin Converter\n\n";
- cout << "The temperature is " << temp << " degrees Kelvin." << "\n" << endl;
- cout << "1.) Return to Main Menu\n";
- cout << "2.) Exit Program\n";
- cout << "> ";
- cin >> choice;
- while (looping == true)
- {
- if (choice == "1") // check that later
- {
- system("clear");
- break;
- }
- if (choice == "2")
- {
- cout << "\nExiting Program...";
- looping = false;
- }
- else
- {
- system("clear");
- cout << "Unknown option: (" << choice << ")\n"
- << "Available Options: 1 & 2\n\nReverted back to Main Menu.\n"
- << "Bug is still being worked out. Thank you for your patience.\n\n";
- break;
- }
- }
- }
- }
- else if (choice == "0")
- {
- cout << "Exiting Program...\n";
- looping = false;
- }
- else
- {
- cout << "Unknown option: (" << choice << ")\n"
- << "Available Options: 1, 2, 3, 4, 0.\n\n";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement