Â
In this, we are going to see Functions, the program is based on function which Calculates, Profit or Loss.
The code given below can be used for TURBO C++ Compiler:-
// cube of a number
#include<iostream.h>
#include<conio.h>
void cube(int a)
{
int cu;
cu = a * a * a;
cout<<cu;
}
void main()
{
clrscr();
int num1;
cout<<"Enter numbers";
cin>>num1;
cube(num1);
getch();
}
The code given below can be used for g++/gcc Compiler:-
// cube of a number
#include<iostream>
using namespace std;
void cube(int a)
{
int cu;
cu = a * a * a;
cout<<cu;
}
int main()
{
int num1;
cout<<"Enter numbers";
cin>>num1;
cube(num1);
return 0;
}
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP