- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7347 Articles for C++
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
2K+ Views
The array is a data structure in c++ that stored multiple data elements of the same data type in continuous memory locations.In c++ programming language, there are inbuilt functions to manipulate array types. Some functions can also be applied to multidimensional arrays. The array header file contains functions to manipulate arrays in c++ programming language.Some common methods to manipulate arrays in c++ are −is_array()This function is used to check if the variable passed to the function is of the type array or not. This method is strict in recognizing arrays that even std:: array is rejected in the check. The ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
30K+ Views
The array is a linear data structure that stores elements of the same data type in continuous memory locations.Array sum is the sum of all elements of the array.In C++ programming language there are multiple methods by with you can find the array sum.Classical methodThe basic method to find the sum of all elements of the array is to loop over the elements of the array and add the element’s value to the sum variable.AlgorithmStep 1 : For i from 0 to n-1, follow step 2 ; Step 2 : sum = sum + arr[i] Step 3 : print sum.Example Live ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
2K+ Views
A queue is a linear data structure in which the order of operation is FIFO (first in first out).The array is a data structure that contains elements of the same data type, stored in continuous memory location.In queue the insertion and deletion operations as done at opposite ends of the queue. The implementation is a bit more complex as compared to the stack.In array implementation of queue, we create an array queue of size n with two variables top and end.Now, initially, the array is empty i.e. both top and end are at 0 indexes of the array. And as ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
363 Views
The array is a collection of elements of the same data type stored in continuous memory locations.C++ standard library contains many libraries that support the functioning of arrays. One of them is an array data() method.The array data() in c++ returns a pointer pointing to the first element of the object.Syntaxarray_name.data();ParameterThere are no parameters accepted by the function.Return typeA pointer to the first element of the array.ExampleProgram To Illustrate The Use Of Array Data() Method − Live Demo#include using namespace std; int main(){ array percentage = { 45.2, 89.6, 99.1, 76.1 }; cout
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
327 Views
An array is a collection of elements of the same data type stored in continuous memory locations.In c++ standard library (STL) there are a lot of methods to support the functioning of the array. One of them is an array at() method.The array at() method is used to return the reference of the element at a specific index value.SyntaxThe general syntax for array at() function isarray_name.at(i);ParametersThe function accepts a single parameter which I the index of the element which is to be accessed using the function.ReturnsThe function returns the element whose index is passed at the time of calling it. ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
508 Views
A complex number is a number that is expressed in the form of a + bi, where a and b are real numbers. i is the imaginary part of number.The argument is the angle between the positive axis and the vector of the complex number. For a complex numberz = x + iy denoted by arg(z), For finding the argument of a complex number there is a function named arg() of a complex number in the complex header file.Syntaxarg(complex_number);ParameterThe function accepts a complex number as input to calculate the value of the argument for that complex number.Returned valueThe function returns ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
904 Views
The array is a collection of a fixed number of items of the same data type. These elements are stored in contiguous memory locations in the memory.Every single element of the value can be accessed from its index value using the brackets “[]” and the array name like a[4], a[3], etc.Declaring ArraysIn c/c++ programming languages, arrays are declared by defining the type and length (number of elements) of the array. The below syntax show declaration of an array in c/c++ −data_tpye array_name[length];For example, declaring an array of type float named the percentage of length 10.float percentage[10]Initializing array valuesIn c++ programming ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
248 Views
The arithmetic number is a number which has the average of all positive divisors is an integer i.e. for a number n if the number of divisors can divide the sum of divisors then n is an arithmetic number.Let’s take an example to understand the concept better, Input : n = 6 Output : YES Explanation : Divisors are 1 , 2 , 3 , 6 Sum = 1+2+3+6 = 12 Number of divisors = 4 Sum of divisors / number of divisor = 12 / 4 = 3AlgorithmStep 1 : Calculate the sum of divisors and store into sum ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
224 Views
The area of a figure is the extent of the figure in two-dimensional plane.Triangle is a polygon with three sides.Parallelogram is a quadrilateral with opposite sides equal and parallel.In this program, we have a parallelogram with its base and height and it inscribed a triangle the same base as the parallelogram. We need to calculate the area of the triangle using the given base and height.Area of triangle constructed take the base of a parallelogram and common height as the parallelogram is given by the formula = 0.5 * base * heightarea = ½ * b * hExample Live Demo#include #include ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
224 Views
The area of a figure is the extent of the figure in two-dimensional plane.Square is a quadrilateral with all its sides equal and all internal angles are right angles.Diagonal of a polygon is the line joining two sides that are not adjacent to each other.ac and bd are the diagonal of the square abcd.In this problem, we are given the length of diagonals of a square and we have to find are of the square.Now in triangle abc, ac2 = bc2 + ab2 d2 = a2 + a2 d = sqrt(2*a2) d2 /2 = a2And we know are of square ... Read More