Destructor In CPP
Destructor: Destructor is a member function of a class. It has the same name as a class but followed by a tilde sign (~). It does not have any return…
Destructor: Destructor is a member function of a class. It has the same name as a class but followed by a tilde sign (~). It does not have any return…
To access personal data of class we use the friend function. The friend function is not the member of the class but still, we can access its members. For calling…
#include<iostream.h> #include<conio.h> void main () { clrscr(); int n,i,x=0; cout << "enter any number" << endl; cin >> n; for(i=2;i<n;i++) { if(n%i==0) { x++; } } if(x==0) { cout <<…
#include<iostream.h> #include<conio.h> void main() { clrscr(); long a,b,c=1; cout << "enter any number" << endl; cin >>a; for(int i=1;i<=a;i++) { c=c*i; } cout << c << endl; getch(); } Output:…
A user is asked to enter 5 elements for searching. Then it will ask you to search that particular number. And it will display its position if the number present…
C++ program to generate random numbers between 1 and 100. For random() function, stdlib.h header file is required. randomize() function will generate different random numbers each time you run the…
Method Overriding- When a function with the same name in the base and derived class is there then the base class function will be overridden(means ignored) and derived class function…
When we declare the static keyword with variables. Then only one copy of that variable will exist and all the object of the class will share the static variable. Static variables…
#include<iostream.h> #include<conio.h> main() { clrscr(); int m[3][3],n[3][3],o[3][3]; for (int i=0;i<=2;i++) // m input { for (int j=0;j<=2;j++) { cout <<"enter matrix elements"; cin >> m[i][j]; } } for (i=0;i<=2;i++) //…
This program will take input from user a 3x3 matrix and print it into the form of matrix. #include<iostream.h> #include<conio.h> main() { clrscr(); int m[3][3]; int i; for (i=0; i…