C++ Programs

Notes of C++

Program 1:- C++ program to print “hello world”  

#include<iostream.h> 

#include<conio.h> 

void main() 

cout<<"\n hello world"; 

getch(); 

}

Output:-




Program 2: - C++ program to Calculate  Area of circle and  circumference of circle. 

#include<iostream.h> 

#include<conio.h> 

void main() 

clrscr(); 

float pie=3.14,r,area,circumference; 

cout<<" enter radius"; 

cin>>r; 

area=pie*r*r; 

cout<<"\n area is"<<area; 

circumference=2*pie*r; 

cout<<"\n circumference is"<<circumference; 

getch();

}

Output:-





Program 3:- C++ program to calculate the ” multiply two number” using class. 

#include<iostream.h> 

#include<conio.h> 

class multi 

public: 

int a,b,multiply; 

void input() 

cout<<"\n enter any two number"; 

cin>>a>>b; 

void show() 

multiply=a*b; 

void display() 

cout<<"\n multiply is"<<multiply; 

}; 

void main() 

clrscr(); 

multi a; 

a.input(); 

a.show(); 

a.display(); 

getch(); 

}  

Output:-  


Post a Comment

0 Comments