Found 7 Questions For C++ Programming

How to Print List Items Containing All Characters of a Given Word

Updated on 20-Mar-2024 18:19:30
In programming, there often arises the need to search through a list of items and find those that contain all the characters of a given word. This task can be efficiently accomplished using various programming languages such as C++, C, Java & Python. In this article, we will explore algorithms and provide code implementations in each of these languages, along with their respective outputs and complexities. Algorithm: The algorithm employed revolves around iterating through each item in the ... Read More

C++ Program to Calculate Area of Right Angle Triangle

Updated on 09-Apr-2023 10:53:56
Introduction: In geometry, a triangle is a three-sided polygon with three angles. Right angle triangle is a special type of triangle which has one angle of 90 degrees. The area of a right angle triangle is half of the product of its base and height. In this article, we will discuss how to calculate the area of a right angle triangle using C++ programming language.  Problem Statement: Write a C++ program to calculate the area of a right angle triangle, given its base and height. Solution: To... Read More

Count of permutations of size 2N with at least N increasing elements

Updated on 01-Apr-2023 17:29:30
Permutations are arrangements of objects in a specific order. In mathematics, a permutation of a set is an arrangement of its elements, without repetition and order being important. Permutations play a significant role in various fields of mathematics, including combinatorics, group theory, and algebra. In this article, we will discuss the count of permutations of size 2N with at least N increasing elements and explain it with an example. C++ CODE // C++ implementation of the approach #includ... Read More

Write C++ Program to Find Quotient and Remainder

Updated on 21-Dec-2021 14:21:21
In this example, you will learn to find the quotient and remainder of a given dividend and divisor. In this program, the user is asked to enter two integers (divisor and dividend) and the quotient and the remainder of their division is computed. To compute quotient and remainder, both divisor and dividend should be integers. Program :  #include <iostream> using namespace std; int main() { int divisor, dividend, quotient, remainder; cout << "E... Read More

Write C++ Program to Add Two Numbers

Updated on 21-Dec-2021 13:13:22
In this program, user is asked to enter two integers. Then, the sum of those two integers is stored in a variable and displayed on the screen. #include <iostream> using namespace std; int main() { int firstNumber, secondNumber, sumOfTwoNumbers; cout << "Enter two integers: "; cin >> firstNumber >> secondNumber; // sum of two numbers in stored in variable sumOfTwoNumbers sumOfTwoNumbers = firstNumber + secondNumber; // Prints... Read More

Write C++ Program to Print Number Entered by User

Updated on 21-Dec-2021 13:03:14
In this example, you'll learn to print the number entered by a user using C++ cout statement. Program : #include <iostream> using namespace std; int main() { int number; cout << "Enter an integer: "; cin >> number; cout << "You entered " << number; return 0; } Output : Enter an integer: 23 You entered 23 Explanation : This program asks the user to enter a number. When the user enters an integer, it is stored ... Read More

Write a program in C++ to print Hello World

Updated on 09-Apr-2023 11:00:56
Program : To print hello world using C++ // Your First C++ Program #include<iostream> int main() { std::cout << "Hello World!"; return 0; } Output : Hello World! Explanation: // Your First C++ Program in C++, any line starting with // is a comment. Comments are intended for the person reading the code to better understand the functionality of the program. It is completely ignored by the C++ compiler. #include : The #include is a preprocessor directive used to include f... Read More



Advertisements

ads