Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C++ Articles - Page 692 of 719
1K+ Views
In a computer system, the octal number is expressed in the octal numeral system while the decimal number is in the decimal numeral system. The octal number is in base 8 while the decimal number is in base 10. In this article, we will write a C++ program that converts a decimal number into an octal number. Examples of decimal numbers and their corresponding octal numbers are as follows. ... Read More
4K+ Views
In this article, we'll show how to write a C++ program to copy strings. A string in C++ is a sequence of characters, such as letters, numbers, symbols, or anything enclosed in double quotes (e.g., "Hello"). Copying a string means transferring all characters from one string to another or making an exact copy. For example, here's how copying works: Input: "Learning C++ is fun!" Output: "Learning C++ is fun!" (This is the copied string) We can copy a string in C++ using the following methods: Using strcpy() Function ... Read More
1K+ Views
In this article, we'll show how to write a C++ program to concatenate two strings. A string in C++ is a sequence of characters like letters, numbers, symbols, or anything enclosed in double quotes (e.g., "Hello"). Concatenating two strings means joining them together to form one combined string. For example, if we have two strings: str1 = "Welcome to" and str2 = "tutorialspoint!", after concatenation, the result will be: result = "Welcome to tutorialspoint!". Approaches to Concatenate Strings in C++ We can concatenate strings in C++ using different methods. Below are the approaches we will cover: ... Read More
2K+ Views
In this article, we will write a C++ program to reverse a sentence using recursion. Reversing a sentence means changing the order of all its characters in each word, so the first character moves to the end, the last character comes to the front, and the middle characters follow in the opposite order. Let's understand this with an example: // Example 1 Input: Welcome to tutorialspoint! // After reversing the sentence Output: !tniopslairotut ot emocleW // Example 2 Input: Learning C++ with tutorialspoint is fun // After reversing the sentence Output: nuf si tniopslairotut htiw ++C gninraeL ... Read More
676 Views
In a computer system, the octal number is expressed in the octal numeral system while the decimal number is in the decimal numeral system. The octal number is in base 8 while the decimal number is in base 10. In this article, we will write a C++ program to convert an octal number to a decimal number and vice-versa. Here are some examples showing decimal numbers and their corresponding octal values: ... Read More
14K+ Views
In this article, we'll show you how to write a C++ program to access elements of an array using pointer. A pointer is a variable that holds the memory address of another variable, allowing us to reference it directly. In other words, pointers point to a memory location and obtaining the value stored at that location is called dereferencing the pointer. By using pointers, we can access and work with array elements through their memory addresses. Let's look at a simple example: Input: An array: [10, 20, 30, 40, 50] // We'll use a pointer to access ... Read More
3K+ Views
In this article, we will show you how to find the length of a string in C++. A string in C++ is a sequence of characters, such as letters, numbers, symbols, or anything enclosed in double quotes (e.g., "Hello"). To find the length of a string, we count all the characters, including spaces, but we don't count the null terminator('\0'). For example, let's look at the following string in C++. // Example 1 Input: "Learning C++ with tutorialspoint is fun!" To find the length, we count every character, including spaces. So, the total length is 40. Output: 40 ... Read More
14K+ Views
A matrix is a rectangular array of numbers arranged in rows and columns. To find the transpose of a matrix, we arrange the rows of the original matrix as columns in a new matrix. Similarly, the columns can also be arranged as rows. An example of the transpose of a matrix is as follows: Finding Transpose of a Matrix To find the transpose of a matrix in C++, we use multidimensional arrays to store matrix values in rows and columns. Then, we swap the rows and columns to get the transpose. Below are the steps we followed: ... Read More
5K+ Views
A matrix is a rectangular array of numbers that is arranged in the form of rows and columns.An example of a matrix is as follows.A 3*3 matrix has 3 rows and 3 columns as shown below −8 6 3 7 1 9 5 1 9A program that multiplies two matrices using multidimensional arrays is as follows.Example Live Demo#include using namespace std; int main() { int product[10][10], r1=2, c1=3, r2=3, c2=3, i, j, k; int a[2][3] = { {2, 4, 1} , {2, 3, 9} }; int b[3][3] = { {1, 2, 3} , {3, 6, 1} , {2, 9, 7} }; if (c1 != r2) { cout
2K+ Views
A matrix is a rectangular array of numbers arranged in rows and columns. To add two matrices, they must be the same size. We add each number in the first matrix to the number in the same position in the second matrix to get a new matrix An example of the addition of two matrices is as follow: Adding Two Matrices Using Multidimensional Arrays To add two matrices in C++, we use multidimensional arrays. These arrays help us store matrix values in rows and columns, just like a real matrix. Then, we add the two matrices stored ... Read More