source file name: defaultconst.cpp #include<iostream.h> #include<conio.h> class FDAmount { long pamt; int yrs; float rt; float amount; public: FDAmount(){} FDAmount(long p, int y, float r=0.12); FDAmount(long p, int y, int r); void display() { cout<<"\n" << "Principal Amount= &…
Read moresource file name: privateconst.cpp // CPP program to demonstrate usage of private constructor #include <iostream.h> //using namespace std; // class A class A{ private: A(){ cout << "constructor of A\n"; } friend class B; }; // class B, friend of class A class B{ public: B(){ A a1; …
Read more9) Write a C++ program that calculates Simple Interest using default arguments values.
source file name : default.cpp #include<iostream.h> #include<conio.h> void printline(int cnt=80, char ch='*') { int n; cout<<endl; for(n=0;n<cnt;n++) { cout<<ch;//<<" "; } } void simpint(long p,int n,float r=5.5f) { double si=(p*n*r)/100; cout<<"\n simple…
Read moresource file name: fruit.cpp #include <iostream.h> #include <string.h> #include< conio.h> int main () { char fr[] = "mango"; char frname[50]; int n; clrscr(); do { cout<<"What is my favourite fruit? "; cin>>frname; n= strcmpi (fr,frname); } …
Read more7) Write a C++ program that finds and display factorial value of given number using function.
source file name: factfn.cpp #include<iostream.h> #include<conio.h> int main() { void fact(int); int n; clrscr(); cout<<" enter any no:"; cin>>n; fact(n); getch(); return 0; } void fact(int n) { int f=1; for(;n>0;n--) f=f*n; cout<<"\n factorial …
Read more6) Write a C++ program that displays Array numbers in Forward and Reverse direction
source file name: arrfr.cpp #include<iostream.h> #include<conio.h> void main() { int i; int A[]={10,20,-30,40,-50,60}; clrscr(); cout<<" Forward direction Array elements\n"; for(i=0;i<6;i++) cout<<A[i]<<" "; cout<<"\n Reverse dir…
Read more