loading
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!!!

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;
}


Step 2: Video Tutorial

Here is a video of the program:

 

Step 3: How It Works

In thisstep I will tell you how it works.

#include <iostream.h>
#include <conio.h>             -          These lines add the base files i.e. iostream.h and conio.h

{clrscr();      -       The '{' marks the starting of our main code. clrscr() means clear screen which clears anything that was written before.
int c, f;       -         This line declares that 'c' and 'f' are integers.
cout << "Welcome......"\n\n\n;          -      This line prints and when we use " symbol it prints the exect words. \n means next line so the next line after leaving 3 lines.
cout << "enter.....";      -          It does the same as the upper one.
cin >> c;                 -              It takes the input of the value of 'c'.
f = c * 1.8 + 32;           -           This line declares the value of 'f'.
cout << "The........ << f;                    -                This line first prints the sentence then it prints the value of f because we didn't use " symbol.
getch();         -           This line halts the program. Without this line the program will come and go in 1 second.
return 0;        -        This line marks the completion of the program
}         -           This bracket is completing the program's code






Step 4: How and Why I Made It

One day I was doing my homework. There were a lot of questions that included converting celsius to farenheit so I thought why not make a program that will do my work. So I got on my computer and started making it.I will be honest, I took some help from my brother.After making it I learnt a lot of things about c++. The next time I make it I will make a graphical one.
<p>Great article here is another series for beginners C++<a href="http://psychocodes.in/blog_view.php?tutorial_id=23" rel="nofollow">http://psychocodes.in/blog_view.php?tutorial_id=23</a></p>
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. <br> <br>#include <br>#include <br>using namespace std; <br> <br>main() <br>{ <br> <br>std::system ( &quot;clear&quot; ); <br> <br>int c, f; <br>cout &lt;&lt; &quot;Welcome, this is a program to covert celsius to farenheit\n\n\n&quot;; <br>cout &lt;&lt; &quot;Enter the degree in celsius: &quot;; <br>cin &gt;&gt; c; <br>f = c * 1.8 + 32; <br>cout &lt;&lt; &quot;The degree in farenheit is &quot; &lt;&lt; f &lt;&lt; &quot;\n&quot;; <br>cin.get(); <br>return 0; <br>} <br>~ <br>~ <br>~ <br>
cstdlib <br>iostream
convention states your use of {} is either right after the function call or one line after. i.e. <br>main(){ <br>} <br>or <br>main() <br>{ <br>} <br> <br>this allows better reading of the code. <br>if you use cout as you have you should keep each part seperate from other parts. weird that didnt sound right but i.e <br>cout &lt;&lt; &quot;Welcome, this is a program to convert Celsius to Farenheit.&quot; <br>cout &lt;&lt; &quot;\n&quot; <br>cout &lt;&lt; &quot;Enter the degree in Celsius:&quot; <br>cin &gt;&gt; c <br> <br>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. <br> <br>hope i helped

About This Instructable

29,251views

23favorites

License:

More by jumper1111:How to make fake Windows error How to make a Origami Flying Bird How to make a Portable Photo Studio for Mobiles 
Add instructable to: