[Tutorial] Creating a Program to Calculate Power of a number

Hi,
If you are a new beginner to C++ than you must start with
learning to code simple programs like this calculator.
I will explain about these codes later, First let me write the code.
Codes are based on Turbo C++ program.

PHP Code:
#include <stdio.h>
#include <conio.h>
#include <math.h>

void main()
{
clrscr();
int numberpowerresult;
printf ("enter number =");
scanf ("%i",&number);
printf ("Enter Power =");
scanf ("%i",&power);
result pow(number,power);
print (
"result is = %i",result);
getch();


Here <stdio.h> and <conio.h> are header files which contains basic Input Output command functions like printing message aka printf and scanning input aka scanf.

#Include command tells Turbo C++ to include the header files <stdio.h> and <conio.h>

If you don't include <stdio.h> (Standard Input Out) file in header than
printf command will not work.
Here <math.h> header file contains mathematical functions like pow aka Power.

First Int command tells Turbo C++ to store integers, Here we have three integers "number, power, result".

Second printf command prints a message on screen asking user to input a number.

Third Scanf command scans for user to input a number.

Fourth printf command prints a message on screen asking user to input a value for power.

Fifth scanf command scans for the value for above print message.

Now we have to write the main function of our program that is telling
C++ to calculate the result via <math.h> header file function.
result = pow(number,power);
This pow command multiplies our integer number with number of times the power is inputted by user.

Sixth print this is final print message with the result of the calculation done.

Last is getch() function. This function will come to action when the program has completed it's task and When you give it an input from keyboard, The program will stop.

So, your program is ready to run, Just click run in Turbo C++ and The program will automatically compile your code and run it.