C++ Articles - Page 103 of 719

C++ Program to Print Upper Star Triangle Pattern

Arnab Chakraborty
Updated on 13-Dec-2022 15:54:44

706 Views

Asterisks "*" are used in star patterns to represent various shapes, such as right-angled triangles or other triangular and diamond shapes. Star patterns are the names for these forms. This tutorial will demonstrate how to use C++ to display the upper left triangle star pattern. Here, we accept as an input the number of lines in the star design. For that many lines, the pattern will be printed. The following table will contain the logic we create to print stars. The following table can help us understand. * * * * * * * * * * * * * ... Read More

C++ Program to delete an item from the array without using the library function

Arnab Chakraborty
Updated on 13-Dec-2022 15:55:55

2K+ Views

The purpose of an array is to provide access to the same type of data across several memory locations via base addresses and indexes. In a wide variety of applications, arrays are used to store data for a wide range of reasons. The array must efficiently handle adding, removing, and updating elements, just like other data structures. Both static and dynamic arrays include a number of library functions in C++ that handle various array-related operations. But in this article, we will see how to delete an element from an array without using any library functions in C++. Understanding the concept ... Read More

C++ Program to Print Left Triangle Star Pattern

Arnab Chakraborty
Updated on 13-Dec-2022 15:51:18

1K+ Views

Star patterns are interesting problems to display different shapes like right-angled triangles or other triangular and diamond shapes using asterisks ‘*’. These shapes are called star patterns. In this article, we will see how to display the left triangle start pattern in C++. Here we take the number of lines for the star pattern as input. It will print the pattern for that number of lines. We will develop the logic to print stars in the following table. Let us follow the table for a better understanding − * * * * * * * * * * * * ... Read More

C++ Program to Print Right Triangle Star Pattern

Arnab Chakraborty
Updated on 13-Dec-2022 15:45:21

4K+ Views

Asterisks "*" are used in star patterns to represent various shapes, such as triangles, diamonds, hollow shapes, etc. Star patterns are the names for these forms. This tutorial will illustrate how to use C++ to display the left triangle star pattern where the triangle is aligned to the left. Here, we accept as an input the number of lines in the star design. For that many lines, the pattern will be printed. The following table will contain the logic we create to print stars. The following table can help us understand. ... Read More

C++ Program to find the second largest element from the array

Arnab Chakraborty
Updated on 13-Dec-2022 15:47:25

5K+ Views

The purpose of an array is to store a similar type of data in a series of the memory places that can be accessed using base addresses and indexes. We use arrays to hold data for a variety of purposes in many different applications. Finding minimum and maximum elements are a fairly common example of arrays that are needed in several applications including sorting, etc. In this article, we will see how we can find the second-largest element from an array in C++. Understanding the concept with examples Given array A = [89, 12, 32, 74, 14, 69, 45, 12, ... Read More

C++ Program to get the magnitude of the given number

Arnab Chakraborty
Updated on 13-Dec-2022 15:37:37

2K+ Views

The magnitude of a given number means the difference between that particular number and zero. It can also mean the size of a mathematical object in terms of other objects of the same kind. We will follow the first definition here, and the magnitude or the absolute value of a number is represented as |x|, where x is a real number. We explore the ways to display the absolute value or magnitude of a given real number. Naïve method We can write a program ourselves that find out the magnitude of a given real number. The example is explained below. ... Read More

C++ Program to fill an array with a specific element

Arnab Chakraborty
Updated on 13-Dec-2022 15:36:29

1K+ Views

Arrays are homogeneous data structures to hold a similar type of data in consecutive memory locations which can be addressed using base addresses and indices. There are plenty of different applications where we use arrays to hold data for suitable uses. Inserting elements into an array is one of the cumbersome processes. We can either insert them by taking inputs from users in a loop or insert them from a file or there are such other processes to insert them. To initialize an array with a specific value (insert that value at all positions of that array) has also a ... Read More

C++ Program to iterate over each element from the arrays

Arnab Chakraborty
Updated on 13-Dec-2022 15:35:13

1K+ Views

A linear sequential data structure called an array is used to store homogeneous data in a series of memory regions. An array needs to have certain features in order to insert, delete, traverse, and update elements effectively, just like other data structures do. Our arrays in C++ are static. In addition, C++ offers a few dynamic array structures. There may be a maximum of Z elements that can be stored inside a static array. And there are currently n elements in it. In this article, we will see how to iterate over all elements present inside the array using C++. ... Read More

C++ Program to check given item is included in the array or not

Arnab Chakraborty
Updated on 13-Dec-2022 17:35:34

6K+ Views

An array is a linear sequential data structure to hold homogeneous data in consecutive memory locations. Like other data structures, an array also must−have features to insert, delete, traverse and update elements in some efficient way. In C++ our arrays are static. There are a few dynamic array structures also available in C++. For a static array, there may be a Z number of elements that can be stored inside that array. And till now we have n elements into it. In this article, we will see how to check whether an element is present inside an array or not ... Read More

C++ Program to add an element in the array at the beginning

Arnab Chakraborty
Updated on 13-Dec-2022 15:25:59

10K+ Views

The storage of homogenous (same) data across several memory locations is made possible by the use of arrays and data structures. The key benefit of using arrays is that we can use the index argument to retrieve them from anywhere we want. This data structure becomes linear because data must be inserted and withdrawn progressively. All we need to do is place the index or position number for that element inside the square bracket to retrieve it from the array. In this article, we will take array A and another element e. We will insert e into A at the ... Read More

Advertisements