how to write nested loop in cpp

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about  how to write nested loop in cpp.So let’s go to our topic #include <iostream> using namespace std; int main () { // local variable declaration: int a = 100; int b = 200; // check the boolean condition if( a … Read more

how to use namespaces be nested in C++?Write the program.

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about how to use namespaces be nested in C++?Write the program. So let’s go to our topic #include <iostream> int x = 20; namespace outer { int x = 10; namespace inner { int z = x; // this x refers … Read more

how to write program to demonstrate Binary Search Algorithms in C++

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about how to write program to demonstrate Binary Search Algorithms in C++ .So let’s go to our topic #include <algorithm> using namespace std; void show(int a[]) { for(int i = 0; i < 10; ++i) cout << ‘\t’ << a[i]; } … Read more

how to write a program in c++ to show constructor

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about how to write a program in c++ to show constructor  .So let’s go to our topic #include<iostream> using namespace std; class Point { private: int x, y; public: /***Constructor****/ Point(int x1, int y1) { x = x1; y = y1; … Read more

A simple and complete C++ program to demonstrate global friend

  #include <iostream> class A { int a; public: A() {a = 0;} friend void showA(A&); // global friend function }; void showA(A& x) { // Since showA() is a friend, it can access // private members of A std::cout << “A::a=” << x.a; } int main() { A a; showA(a); return 0; }   … Read more

how to 1 to 100 in C++, without loop and recursion

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about how to 1 to 100 in C++, without loop and recursion .So let’s go to our topic #include <iostream> using namespace std; template<int N> class PrintOneToN { public: static void print() { PrintOneToN<N-1>::print(); // Note that this is not recursion … Read more

how to program enter a letter and output the next 2 letters

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about  how to program enter a letter and output the next 2 letters .So let’s go to our topic #include <iostream.h> #include <conio.h> void main() { clrscr(); char charac; cout << “Enter your letter : ” << endl; cin>>charac; cout << … Read more