sizeof operator in CPP
sizeof is a keyword. It determines the size in bytes of variables and datatypes as seen in the example. #include<iostream.h> #include<conio.h> void main() { clrscr(); cout << sizeof(int) << endl;…
sizeof is a keyword. It determines the size in bytes of variables and datatypes as seen in the example. #include<iostream.h> #include<conio.h> void main() { clrscr(); cout << sizeof(int) << endl;…
A simple Program to find the length of the string without using the predefined string function. This will not count the null character. #include<iostream.h> #include<conio.h> void main() { clrscr(); int…
1. strlen() - This function returns the length of the string as seen in the output. This function does not return the null character(if there is space between strings it…
Do while loop condition fails: one output when we use do while loop it gives us an advantage that even the condition fails it gives at least one initial output…
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…