How to Make a Basic C++ Program
by jumper1111 in Circuits > Computers
44707 Views, 26 Favorites, 0 Comments
How to Make a Basic C++ Program
![c++.jpg](/proxy/?url=https://content.instructables.com/FY0/Q77H/HD4VG209/FY0Q77HHD4VG209.jpg&filename=c++.jpg)
Welcome. In this instructable you will learn to make a simple non- graphical c++ program. The program will convert celsius to farenheit.
Making It!!!
![c++ 2.jpg](/proxy/?url=https://content.instructables.com/F9U/ONTX/HD4VG22X/F9UONTXHD4VG22X.jpg&filename=c++ 2.jpg)
![c++.jpg](/proxy/?url=https://content.instructables.com/FZ8/DBDV/HD4VG24M/FZ8DBDVHD4VG24M.jpg&filename=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;
}
#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;
}
Video Tutorial
Here is a video of the program:
How It Works
![download.jpg](/proxy/?url=https://content.instructables.com/FUO/4Q8M/HD4VG031/FUO4Q8MHD4VG031.jpg&filename=download.jpg)
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
#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
How and Why I Made It
![download (1).jpg](/proxy/?url=https://content.instructables.com/F01/7KCO/HD4VG045/F017KCOHD4VG045.jpg&filename=download (1).jpg)
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.