Basically,When we call any function the control of the program shifts
towards the function and execuate the all portion in the function and
when it find the return statement the control goes to
the main and execuate the further part of the main function.So if we write
anyting after the return staement it does not execute so local varaibles are
formed and removed on the function calling ,so it helps us to know how every part
of the program can execuate
How Function can be write as?
dataType funationName(datatype varibaleName1,datatype varibaleName2,.....)
Types of the functions
1.Void Functions(non-return Type)
2.dataType Functions(return-Type)
3.dataType Functions(non-returnType)
4.Pass by refernce Functions (argumantatiev dependent functions)
5.Recursive Functions
***Functions has also Prototypes***
#include
#include
#include
using namespace std;
void input(int arr[],int size)
{
for(int i=0;i
#include
#include
#include
#include
#include
using namespace std;
const int row = 10;
const int col = 100;
void displaygeneral(char mat[][col], int row)
{
system("cls");
cout << " ____________________________________________________________________________________________________" << endl;
for (int i = 0; i < row; i++)
{
cout << "|";
for (int j = 0; j < col; j++)
{
cout << mat[i][j];
}
cout << "|";
if (i != 10)
cout << endl;
}
cout << " ____________________________________________________________________________________________________" << endl;
}
void start(char mat[][col], int row)
{
for (int i = 0; i < row; i++)
{
for (int j = 0; j < col; j++)
{
if (i == 0 && j == 0 )
{
mat[0][0] = 3;
}
else
mat[i][j] = ' ';
}
}
displaygeneral(mat, row);
}
void moveright(char mat[][col], int row, int &pos,int &down)
{
int temp;
temp = mat[down][pos + 1];
mat[down][pos + 1] = mat[down][pos];
mat[down][pos] = temp;
pos++;
}
void moveleft(char mat[][col], int row, int &pos,int &down)
{
int temp;
temp = mat[down][pos - 1];
mat[down][pos - 1] = mat[down][pos];
mat[down][pos] = temp;
pos--;
}
void movedown(char mat[][col], int row, int &pos,int &down)
{
int temp;
temp = mat[down+1][pos];
mat[down+1][pos] = mat[down][pos];
mat[down][pos] = temp;
down++;
}
void moveup(char mat[][col], int row, int &pos, int &down)
{
int temp;
temp = mat[down - 1][pos];
mat[down - 1][pos] = mat[down][pos];
mat[down][pos] = temp;
down--;
}
void menu(char mat[][col],int row,int rightpos,int &downpos)
{
bool flag = false;
do
{
int ch;
ch = getch();
ch=tolower(ch);
while (ch != 'd' && ch != 'a' && ch != 'w' && ch != 's' && ch != 'q' )
{
cout<<"Invalid input:"<
#include
#include
#include
#include
using namespace std;
void input(int arr[],int size)
{
for(int i=0;i>n;
cout<<"The element that is present at the "<
#include
#include
#include
#include
using namespace std;
void random()
{
int x = time(0);
srand(x);
}
void input(int arr[], int size)
{
for (int i = 0; i < size; i++)
{
arr[i] = (rand() % 10) + 1;
}
}
void output(int arr[], int size)
{
cout<<"The usorted elements in the array:"<
#include
#include
#include
#include
using namespace std;
const int row=5;
const int col=5;
void random();
void inputmatrix(int mat[][col],int row);
void outputmatrix(int mat[][col],int row);
void transpos(int trans[][col], int row, int mat[][col], int rowMat);
void displayTranspose(int trans[][col], int row) ;
void display();
int main()
{
display();
}
void random()
{
int x = time(0);
srand(x);
}
void inputmatrix(int mat[][col],int row)
{
for(int i=0;i>mat[i][j];
}
}
}
void outputmatrix(int mat[][col], int row){
cout<<"The matrix as:"<
#include
using namespace std;
void alphabtaes(char ch)
{
if(ch<=90)
{
cout<
#include
using namespace std;
void print(int n)
{
if(n<=50)
{
cout<
#include
using namespace std;
int fact(int);
int input();
int main()
{
cout << fact(input());
return 0;
}
int input()
{
int n;
cout<<"Enter a number:"<>n;
return n;
}
int fact(int n)
{
if(n==1)
{
return 1;
}
return(n*fact(n-1));
}
#include
using namespace std;
int power(int n=2, int p=2);
int power(int , int , int );//prototypes
int main()
{
int n, p;
cin >> n;
cin >> p;
cout << power(); // default parameters
cout << power(n,p)<
If you don't find any problem,in this website and if you have a very difficult assignment question that is not present on internet ,then you dont bother yourself,we are here to solve every problem of your life you just click on the Problem asking button and write your problem we slove the code of your problem and sent you on your email addres that you put in the sin up form.