The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
I'm a beginner lol
Posted by: Temperature | May 29, 2010 @ 12:19pm
C Code
[
Download
]
#include <iostream> #include <windows.h> using namespace std; void main() { int option; bool flag = 0; float value, convert = 0; //Note to myself, system is not compatible with *nix I think system("title Temperature Convertions"); system("Color C"); cout << "Program that converts from Fahrenheit to Celsius or Celsius to Fahrenheit\n"; do { cout << "Select one of this options: " << endl; cout << "Type 1 if you wish to convert from Celsius to Fahrenheit" << endl; cout << "Type 2 if you wish to Fahrenheit to Celsius" << endl; cout << "Type 3 if you wish to exit" << endl; cout << "What option would you take? : "; cin >> option; switch(option) { case 1: cout << "type the temperature in Celsius: "; cin >> value; cout << "The value in Fahrenheit would be: " << (convert = (value * 9)/5 +32) << endl; flag = 1; break; case 2: cout << "Type the temperature in Fahrenheit: "; cin >> value; cout << "The value in Celsius would be: " << (convert = (value - 32) * 5/9) << endl; flag = 1; break; case 3: cout << "See you next time\n"; flag = 1; break; default: cout << "Incorrect option, please follow the instructions at the begining of the program"; Sleep(1000); system("cls"); break; } }while(flag == 0); system("pause"); }
Syntax Highlighting
[
Open in new window
]
Author Comments
If you find bugs or spelling error I did translate from Spanish to English lol
Rating
4.47 / 8
60 Votes