loading
Picture of How to make a basic c++ program
Welcome. In this instructable you will learn to make a simple non- graphical c++ program. The program will convert celsius to farenheit.

Step 1: Making it!!!

Picture of Making it!!!
c++.jpg
So lets start making it. These are the codes for making it :


#include
#include

main()

{clrscr();
int c, f;
cout << "Welcome, this is a program to covert celsius to farenheit\n\n\n";
cout << "Enter the degree in celsius: ";
cin >> c;
f = c * 1.8 + 32;
cout << "The degree in farenheit is " << f;
getch();
return 0;
}


 
THAWKK2 years ago
Why not explain the code a little bit more. And I think you got this code out of Beginning Programming with C++ for Dummies
Had to find out how to do it in linux.

#include
#include
using namespace std;

main()
{

std::system ( "clear" );

int c, f;
cout << "Welcome, this is a program to covert celsius to farenheit\n\n\n";
cout << "Enter the degree in celsius: ";
cin >> c;
f = c * 1.8 + 32;
cout << "The degree in farenheit is " << f << "\n";
cin.get();
return 0;
}
~
~
~
cstdlib
iostream
crackHacker2 years ago
convention states your use of {} is either right after the function call or one line after. i.e.
main(){
}
or
main()
{
}

this allows better reading of the code.
if you use cout as you have you should keep each part seperate from other parts. weird that didnt sound right but i.e
cout << "Welcome, this is a program to convert Celsius to Farenheit."
cout << "\n"
cout << "Enter the degree in Celsius:"
cin >> c

again this is to keep the code clean and readable for the next coder. not that there would be a next coder however if you do it all the time you make it a habbit and it helps later on in a career.

hope i helped