Simple Example Program For Constructor Overloading In C++

#include<iostream> #include<conio.h> using namespace std; class Example { // Variable Declaration int a,b; public: //Constructor wuithout Argument Example() { // Assign Values In Constructor a=50; b=100; cout<<”\nIm Constructor”; } //Constructor with Argument Example(int x,int y) { // Assign Values In Constructor a=x; b=y; cout<<”\nIm Constructor”; } void Display() {cout<<”\nValues :”<<a<<”\t”<<b; } }; int main() { … Read more

Simple Example Program For Parameterized Constructor In C++

#include<iostream> #include<conio.h> using namespace std; class Example { // Variable Declaration int a,b; public: //Constructor Example(int x,int y) { // Assign Values In Constructor a=x; b=y; cout<<“Im Constructor\n”; } void Display() { cout<<“Values :”<<a<<”\t”<<b; } }; int main() { Example Object(10,20); // Constructor invoked. Object.Display();// Wait For Output Screen getch(); return 0; }   Output … Read more

Simple Example Program For Constructor In C++

  #include<iostream> #include<conio.h> using namespace std; class Example { // Variable Declaration int a,b; public: //Constructor Example() { // Assign Values In Constructor a=10; b=20; cout<<“Im Constructor\n”; } void Display() { cout<<“Values :”<<a<<”\t”<<b; } }; int main() { Example Object; // Constructor invoked. Object.Display();// Wait For Output Screen getch(); return 0; }   Output : … Read more

Do While Loop Example Program In C++

  #include<iostream> #include<conio.h> using namespace std; int main() { // Variable Declaration int a; // Get Input Value cout<<“Enter the Number :”; cin>>a; int counter = 1; //Do while Loop Block do { cout<<“Execute Do While “<<counter<<” time”<<endl; counter++; }while (counter <= a); // Wait For Output Screen getch(); return 0; }   Output : … Read more

While Loop Example Program In C++

  #include<iostream> #include<conio.h> using namespace std; int main() { // Variable Declaration int a; // Get Input Value cout<<“Enter the Number :”; cin>>a; int counter = 1; //while Loop Block while (counter <= a) { cout<<“Execute While “<<counter<<” time”<<endl; counter++; } // Wait For Output Screen getch(); return 0; }   Output : Enter the … Read more

how to write For Loop Example Program In C++

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about  how to write For Loop Example Program In C++ .So let’s go to our topic #include<iostream> #include<conio.h> using namespace std; int main() { // Variable Declaration int a; // Get Input Value cout<<“Enter the Number :”; cin>>a; //for Loop Block … Read more

how to write if..else Statement Example Program In C++

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about  how to write if..else Statement Example Program In C++.So let’s go to our topic #include<iostream> #include<conio.h> using namespace std; int main() { // Variable Declaration int a; // Get Input Value cout<<“Enter the Number :”; cin>>a; //If Condition Check if(a … Read more

how to write if Statement Example Program in C++ ,CPP

 Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about  this how to write if Statement Example Program in C++ ,CPP.So let’s go to our topic The basic Syntax of if statement is: if(test_expression) { statement 1; statement 2; … } include<iostream> #include<conio.h> using namespace std; int main() { // … Read more

how to write First cpp program

Welcome to our blog techgsr.co . Here, you can learn basic concepts of cpp programming interview questions and also from basic to advanced levels programs. This cpp tutorial is specially designed for beginners and experienced. It will guide you step by step to learn every concept of the in cpp programming language. We have taken great … Read more

How to find factorial of a given number using C++ program | techgsr

Welcome to our blog post In this program, we will learn program how to find factorial of a given number using C++ program? Here, we will implement this program with and without using user define function.   Logical Part of program: Input a number Initialize the factorial variable with 1 Initialize the loop counter with N (Run … Read more