Showing posts with label c plus plus programs. Show all posts
Showing posts with label c plus plus programs. Show all posts

Program in c++ of using inline function


#include<iostream.h>
#include<conio.h>
int b=100;
void main()
{
clrscr();
int b=50;
            {
            int bh=b;
            int b=25;
            cout<<"we are in the inner block";
            cout<<"bh="<<bh<<"\n";
            cout<<"b="<<b<<"\n";
            cout<<"::b="<<::b<<"\n";
            }

cout<<"\nwe are int the outer block\n";
cout<<"b="<<b<<"\n";
cout<<"::b"<<::b<<"\n";
getch();
}


Output:


Program in c++ of using scope resolution operator


#include<iostream.h>
#include<conio.h>
void main()
{
int num1,num2;
float ave;
clrscr();
cout<<"enter the two no\n";
cin>>num1>>num2;
ave=float(num1+num2)/2;
cout<<"The average of two no is = "<<ave;
getch();
}


Output:

Program to print the average of two number in C++

 
My Study Voice © 2015 - Designed by Templateism.com | Distributed By Blogger Templates