Found 7347 Articles for C++

Basic Graphic Programming in C++

sudhir sharma
Updated on 22-Nov-2019 07:06:43

17K+ Views

C++ programming language is a versatile programming language. Using C++ you can create low end graphics too i.e. creating basic shapes and words with stylish fonts and adding colors to them can be done using c++.Graphic programming can be done in c++ using your terminal or command prompt or you can download DevC++ compiler to create graphic programs.For terminal you need to add the graphics.h libraray to you GCC compiler. For this you will have type in the following commands.>sudo apt-get install build-essential >sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-2.0 \ guile-2.0-dev libsdl1.2debian libart-2.0-dev libaudiofile-dev \ libesd0-dev libdirectfb-dev libdirectfb-extra libfreetype6-dev \ ... Read More

Basic Concepts of Object Oriented Programming using C++

sudhir sharma
Updated on 02-Sep-2023 15:38:57

43K+ Views

Object oriented programming is a type of programming which uses objects and classes its functioning. The object oriented programming is based on real world entities like inheritance, polymorphism, data hiding, etc. It aims at binding together data and function work on these data sets into a single entity to restrict their usage.Some basic concepts of object oriented programming are −CLASSOBJECTSENCAPSULATIONPOLYMORPHISMINHERITANCEABSTRACTIONClass − A class is a data-type that has its own members i.e. data members and member functions. It is the blueprint for an object in object oriented programming language. It is the basic building block of object oriented programming in ... Read More

C++ program to find the sum of the series 1 + 1/2^2 + 1/3^3 + …..+ 1/n^n

Ayush Gupta
Updated on 09-Jul-2020 08:51:51

644 Views

In this tutorial, we will be discussing a program to find the sum of the given series 1 + 1/2^2 + 1/3^3 + …..+ 1/n^n.For this, we will be given with the value of n and our task is to add up every term starting from the first one to find the sum of the given series.Example#include #include using namespace std; //calculating the sum of the series double calc_sum(int n) {    int i;    double sum = 0.0, ser;    for (i = 1; i

C++ Program to find the sum of the series 23+ 45+ 75+….. upto N terms

Ayush Gupta
Updated on 09-Jul-2020 08:52:15

151 Views

In this tutorial, we will be discussing a program to find the sum of the given series 23+ 45+ 75+….. upto N terms.For this, we will be given with the value of N and our task is to add up every term starting from the first one to find the sum of the given series.After solving this, we get the formula for the sum of the series;Sn = (2n(n+1)(4n+17)+54n)/6Example#include using namespace std; //calculating the sum of the series int calc_sum(int N) {    int i;    int sum = (2 * N * (N + 1) * (4 * ... Read More

C++ program to find the sum of the series 1/1! + 2/2! + 3/3! + 4/4! +…….+ n/n!

Ayush Gupta
Updated on 09-Jul-2020 08:52:42

411 Views

In this tutorial, we will be discussing a program to find the sum of the given series 1/1! + 2/2! + 3/3! + 4/4! +…….+ n/n!.For this, we will be given with the value of n and our task is to add up every term starting from the first one to find the sum of the given series.Example#include using namespace std; //calculating the sum of the series double calc_sum(int n) {    int i;    double sum = 0, fact=1;    for (i = 1; i

C++ program to find the sum of the series (1/a + 2/a^2 + 3/a^3 + … + n/a^n)

Ayush Gupta
Updated on 09-Jul-2020 08:53:06

104 Views

In this tutorial, we will be discussing a program to find the sum of the given series (1/a + 2/a^2 + 3/a^3 + … + n/a^n).For this, we will be given with the value of n and our task is to add up every term starting from the first one to find the sum of the given series.Example#include #include using namespace std; //calculating the sum of the series float calc_sum(int a, int n) {    int i;    float sum = 0;    for (i = 1; i

C++ program to find the sum of the series (1*1) + (2*2) + (3*3) + (4*4) + (5*5) + … + (n*n)

Ayush Gupta
Updated on 09-Jul-2020 08:53:33

252 Views

In this tutorial, we will be discussing a program to find the sum of the given series (1*1) + (2*2) + (3*3) + (4*4) + (5*5) + … + (n*n).For this, we will be given with the value of n and our task is to add up every term starting from the first one to find the sum of the given series.Example#include using namespace std; //calculating the sum of the series int calc_sum(int n) {    int i;    int sum = 0;    for (i = 1; i

C++ program to find the Sum of each Row and each Column of a Matrix

Ayush Gupta
Updated on 09-Jul-2020 08:53:58

2K+ Views

In this tutorial, we will be discussing a program to find the sum of each row and each column for a given matrix.For this, we will be given with a say A*B matrix. Our task is to traverse through all the elements of the matrix and find the sum of each row and each column of the matrix.Example#include using namespace std; #define m 7 #define n 6 //calculating sum of each row void calc_rsum(int arr[m][n]){    int i,j,sum = 0;    for (i = 0; i < 4; ++i) {       for (j = 0; j < 4; ++j) {          sum = sum + arr[i][j];       }       cout

C++ program to find the smallest element among three elements

Ayush Gupta
Updated on 09-Jul-2020 08:54:23

2K+ Views

In this tutorial, we will be discussing a program to find the smallest element among the provided three elements.We will be provided with three elements/ integers and our task is to compare them and find the smallest element/ integer among them.Example#include using namespace std; int main() {    int a = 45, b = 72, c = 10;    if (a

C++ program to find the side of the Octagon inscribed within the square

Ayush Gupta
Updated on 09-Jul-2020 08:54:48

68 Views

In this tutorial, we will be discussing a program to find the side of the octagon inscribed within a given square.For this, we will be given with the side of a square and our task is to find the side of the largest octagon that can be inscribed in it.Finding the relation between the sides of the square and the octagon, we find the formula for the side of the octagonside of square/(√2 + 1)Example#include using namespace std; //calculating the side of the octagon float calc_oside(float a) {    if (a < 0)       return -1;   ... Read More

Advertisements