selection sort algorithm in data structure

Algorithm: Step 1: Select 1St element of the list. Step 2: Compare selected elements with other elements in the list one by one. Step 3: For every comparison, if any element is smaller then selected element then these two are swapped. Step 4: Repeat the same procedure with next position in the list till the … Read more

Predict the output of following C++ program in cpp

 

 Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about  Predict the output of following C++ program in cpp .So let’s go to our topic

#include<iostream>
using namespace std;
class Test
{
static int i;
int j;
};
int Test::i;
int main()
{
cout << sizeof(Test);
return 0;
}

Assume that integers take 4 bytes.

Output:
4 (size of integer)
static data members do not contribute in size of an object. So ‘i’ is not considered in size
of Test. Also, all functions (static and non-static both) do not contribute in size.

Related Post:-

Predict the output of following C++ program in cpp

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

Factorial Using Loop Example Program In C++

bfs algorithm in data structure (BFS)

if..else Statement Example Program In C++

For Loop Example Program In C++

Program to find the sum of each row & column of a matrix of size n x m andif matrix is square, find the sum of the diagonals also.

 tudo app using html and css javascript

how to create age calculator in html project

how to make toast in html css and javascript

how to make copy to clipboard in javascript

how to create email validation in javascript

So I hope that you learn about the  Predict the output of following C++ program in cpp And if you have any more queries about computer relegated then feel free to discuss your problem in the comment section.Thank you so much and come back for more updates about Techgsr.co .

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