- 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++
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
6K+ Views
Given with an array of integer elements and the task is to multiply the elements of an array and display it.ExampleInput-: arr[]={1, 2, 3, 4, 5, 6, 7} Output-: 1 x 2 x 3 x 4 x 5 x 6 x 7 = 5040 Input-: arr[]={3, 4, 6, 2, 7, 8, 4} Output-: 3 x 4 x 6 x 2 x 7 x 8 x 4 = 32256Approach used in the below program is as follows −Initialize temporary variable to store the final result with 1Start loop from 0 to n where n is the size of an arrayKeep multiplying ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
1K+ Views
Given with the sentence of multiple strings and the task is to find the length of the longest string in the sentence.ExampleInput-: hello I am here Output-: maximum length of a word is: 5 Input-: tutorials point is the best learning platform Output-: maximum length of a word is: 9Approach used in the below program is as follows −Input the string in an array of stringsTraverse the loop till the end of a sentence is not foundTraverse one particular string of a sentence and calculate its length. Store the length in a variablePass the integer values of length of strings ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
512 Views
Given with the string and the task is to calculate the length of the given string using a user defined function or in-built function.Length of a string can be calculated using two different ways −Using user defined function − In this, traverse the entire string until ‘\o’ is found and keep incrementing the value by 1 through recursive call to a function.Using user in-build function − There is an in-build function strlen() defined within “string.h” header file which is used for calculating the length of a string. This function takes single argument of type string and return integer value as ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
3K+ Views
Given with a hexadecimal number as an input, the task is to convert the given hexadecimal number into a decimal number.Hexadecimal number in computers is represented with base 16 and decimal number is represented with base 10 and represented with values 0 - 9 whereas hexadecimal number have digits starting from 0 – 15 in which 10 is represented as A, 11 as B, 12 as C, 13 as D, 14 as E and 15 as F.To convert a hexadecimal number into a decimal number follow these steps −We will extract digits starting from right to left through a remainder ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
88 Views
Given with an array of integers and the task is to calculate the bitonicity of a given array using a function.Bitonicity of an array is −Initialised to 0Incremented to 1 when the next element is greater than the previous valueDecremented to 1 when the next element is lesser than the previous valueExampleInput-: arr[] = { 1, 4, 3, 5, 2, 9, 10, 11} Output-: Bitonicity of an array is : 3Explanation −Initialize bitonicity calculating variable let’s say temp with 0.Start from the first element of an array which is 1. Now compare arr[i] and arr[i-1] i.e. compare 4 and 1 ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
141 Views
Given with an octal number as an input, the task is to convert the given octal number into a decimal number.Decimal numbers in computer is represented with base 10 and octal number is represented with base 8 starting from the digit 0 till 7 whereas decimal numbers can be any numeric digit starting from 0 – 9.To convert an octal number into a decimal number follow these steps −We will extract digits starting from right to left through a remainder and then multiply it with the power starting from 0 and will be increased by 1 till the (number of ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
300 Views
Given with temperature ‘n’ in Fahrenheit and the challenge is to convert the given temperature to kelvin and display it.ExampleInput 1-: 549.96 Output -: Temperature in fahrenheit 549.96 to kelvin : 561.256 Input 2-: 23.45 Output -: Temperature in fahrenheit 23.45 to kelvin : 268.4For converting the temperature from Fahrenheit to Kelvin, there is a formula which is given belowK = 273.5 + ((F - 32.0) * (5.0/9.0))Where, K is temperature in kelvin and F is temperature in FahrenheitApproach used below is as follows −Input temperature in a float variable let’s say FahrenheitApply the formula to convert the temperature into ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
1K+ Views
Given with a decimal number as an input, the task is to convert the given decimal number into a hexadecimal number.Hexadecimal number in computers is represented with base 16 and decimal number is represented with base 10 and represented with values 0 - 9 whereas hexadecimal number have digits starting from 0 – 15 in which 10 is represented as A, 11 as B, 12 as C, 13 as D, 14 as E and 15 as F.To convert a decimal number into a hexadecimal number follow the given steps −Firstly divide the given number with the base value of conversion ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
208 Views
Given with a decimal number as an input, the task is to convert the given decimal number into a binary number.Decimal number in computers is represented with base 10 and binary number is represented with base 2 as it has only two binary digits 0 and 1 whereas decimal numbers can be any numeric digit starting from 0 – 9.To convert a decimal number into a binary number follow the given steps −Firstly divide the given number with the base value of conversion number e.g. dividing 42 by 2 because we need to convert 42 into a binary numbers which ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
262 Views
Given with a binary number as an input, the task is to convert the given binary number into a decimal number.Decimal number in computers is represented with base 10 and binary number is represented with base 2 as it has only two binary digits 0 and 1 whereas decimal numbers can be any numeric digit starting from 0 – 9.To convert a binary number into a decimal number we will extract digits starting from right to left through a remainder and then multiply it with the power of 2 starting from 0 and will be increased by 1 till the ... Read More