#include<conio.h>
#include<iostream.h>
void function1()
{
int x1=0;
cout<<"The value of x1= \n" <<x1<<"\n";
x1=x1+1;
}
void function2()
{
static int x2=0;
cout<<"The value of x2= \n" <<x2<<"\n";
x2=x2+1;
}
void main()
{
clrscr();
function1();
function1();
function1();
function2();
function2();
function2();
getch();
}
OUTPUT::
The value of x1= 0
The value of x1=0
The value of x1=0
The value of x2=0
The value of x2=1
The value of x2=2
#include<iostream.h>
void function1()
{
int x1=0;
cout<<"The value of x1= \n" <<x1<<"\n";
x1=x1+1;
}
void function2()
{
static int x2=0;
cout<<"The value of x2= \n" <<x2<<"\n";
x2=x2+1;
}
void main()
{
clrscr();
function1();
function1();
function1();
function2();
function2();
function2();
getch();
}
OUTPUT::
The value of x1= 0
The value of x1=0
The value of x1=0
The value of x2=0
The value of x2=1
The value of x2=2
No comments:
Post a Comment