C++ Program to Find Largest Rectangular Area in a Histogram

This C++ Program Finds the Largest Rectangular Area in a Histogram. Here is source code of the C++ Program to Find the Largest Rectangular Area in a Histogram. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below. /*  * C++ Program to Find Largest Rectangular … Read more

advertisement

C++ Program to Count the Number of Ones in the Given Number

This C++ Program which counts the number of ones in the given number. The program uses a while loop to go through each and every digit of the given number and increments the variable count if the current digit is 1. Here is source code of the C++ program which counts the number of ones … Read more

advertisement

C++ Program to Find the One’s Complement of Positive Integer

This C++ Program which prints the 1’s complement of a positive integer. The program takes a number as the input and determines the each bit of the binary form of the number using a recursive function which is given the number as the parameter and negates it. The function saves the remainder of the division … Read more

advertisement

C++ Program to Find the Sum of Geometric Progression Series

This C++ program calculates the sum of geometric progression. The program takes the first term, the common ratio and the number of terms as input. A function is called to calculate the sum of the progression and to print it. Here is the source code of the C++ program calculates the sum of geometric progression. … Read more

advertisement

C++ Program to Perform Mathematical Operation on Valarray Elements

This C++ program illustrates the application of mathematical operation to valarrays. The elements of valarray are initialized to an int. The program adds two valarrays, performs scalar multiplication with valarrays and computes value of trigonometric ratio of each element of valarrays. Here is the source code of the C++ program illustrates the use of valarrays. … Read more

advertisement

C++ Program to Find the Median of Numbers

This C++ program computes the median of the given set of numbers. The program takes the count of numbers that are to be input, the elements are input and stored in a vector and sorted. The median of the elements is computed accordingly, i.e. if the count of the numbers is even, the average of … Read more

advertisement

C++ Program to Find the Maximum Value using Macros

This C++ program computes the maximum value using macros. A macro is a #define preprocessor directive which give instruction to the compiler to preprocess the information before actual compilation starts. All subsequent occurrences of macro in the program will be replaced by replacement-text before the program is compiled. The macro-text should be written carefully using … Read more

advertisement

C++ Program to Find the Inverse of a Trigonometric Ratio

This C++ program computes inverse of a trigonometric ratio. The program enters a choice as to inverse of which trigonometric ratio the user wants to compute the value. The user enters the trigonometric ratio of the chosen type and the inverse of trigonometric ratio is computed and printed. Here is the source code of the … Read more

advertisement

C++ Program to Illustrate Trigonometric Functions

This C++ program illustrates the use of trigonometric functions. The trigonometric functions are declared in ‘math.h’ or ‘cmath’ header which is included in this program. The angles in radians are passed as parameters to these functions. Here is the source code of the C++ program illustrates the use of trigonometric functions. The C++ program is … Read more

advertisement

C++ Program to Check if a Number is Divisible by Second Number

This C++ Program which checks if a number is divisible by second number. The program takes two numbers as the input and uses modulus operator to determine whether the first number is completely divisible by second number. Here is source code of the C++ program which checks if a number is divisible by second number. … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.