0% found this document useful (0 votes)
38 views2 pages

Practical No 2oop Manual

Uploaded by

shewalesiddhu73
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views2 pages

Practical No 2oop Manual

Uploaded by

shewalesiddhu73
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Scope Resolution Operator

#include<iostream.h>
Q.Write a C++ program for scope #include<conio.h>
resolution operator. void main()
{
#include<iostream.h> int a=15;
#include<conio.h> cout<<"local a="<<a<<"Global
a="<<::a;
int s=5; ::a=20;
void main() cout<<"\n Local a="<<a<<"Global
{ a="<<::a;
int s=20; getch();
cout<<"local variable="<<s<<endl; }
cout<<"global variable:"<<::s;
getch(); OUTPUT:
} Local a=15 Global a=10
Local a=15 Global a=20
OUTPUT:
Local variable=20
Global variable=5

Manipulator

#include<iostream.h> cout<<setfill('*')<<setw(10)<<"Out
#include<conio.h> put"<<endl;
#include<iomanip.h> cout<<setprecision(10)<<pi<<endl;
void main() cout<<setbase(16)<<num<<endl;
{ getch();
float pi=3.14; }
int num=100;
char str[20]="Welcome";
clrscr(); OUTPUT:
cout<<"Entering a new Entering a new line
line"<<ends<<endl; Output
cout<<setw(10)<<"Output"<<endl; ****output
cout<<setfill('*')<<setw(10)<<"Out 3.1400000000
put"<<endl; 64

You might also like