C++ Program to Swap Two Numbers Without using a Temporary Variable

This is a C++ Program to swap 2 numbers without using a Temp Variable. Problem Description We have to write a C++ Program to swap two numbers without using a third variable i.e. the temp variable. Expected Input and Output Input: a = 20, b = 10 Output: a = 10, b = 20 Problem … Read more

advertisement

C++ Program to Reverse a Number

This C++ Program which displays a given number with its digits reversed. The program uses a while loop to go through each and every digit of the given number, adds it to the reversed number, multiplies it by 10 and adds them up in the loop. Here is source code of the C++ program which … Read more

advertisement

C++ Program to Print All Perfect Cubes below 1000

This C++ program prints all the perfect cubes below 1000. The program first calculates the value below which all the numbers have their cubes less than 1000 and then prints all their cubes. Here is the source code of the C++ program which prints all the perfect cubes below 1000. The C++ program is successfully … Read more

advertisement

C++ Program to Generate a Sequence of Ulam Numbers

This C++ Program which generates a sequence of ulam numbers. Ulam number is defined to be the smallest integer that is the sum of two distinct earlier terms in exactly one way. The program uses 1 and 2 as the first two terms and the other terms are generated on the basis of definition of … Read more

advertisement

C++ Program to Create an Abstract Class Solid which Implements Shapes by Inheriting from Solid Class

This C++ program which creates an abstract class solid from which cylinder, sphere and cone have been inherited . A class is called an abstract class when it contains one or more purely virtual function. An abstract class can never be instantiated but inherited. The ‘Solid’ class is implemented as an abstract class from which … Read more

advertisement

C++ Program to Find the Area of Shapes using Switch Case

This C++ program computes area of a shape using switch case. The program takes shape as an input and identifies the shape using a switch case. The statements then takes required values as input, computes the area and prints it. Here is the source code of the C++ program computes area of a shape using … Read more

advertisement

C++ Program to Find the Area of a Circle

This C++ Program which computes area of circle. The program takes radius of the circle as an input, calculates the area of the circle and outputs it on the screen. Here is source code of the C++ program which computes area of circle. The C++ program is successfully compiled and run on a Linux system. … Read more

advertisement

C++ Program to Print ASCII Table (0 – 127)

This C++ Program which prints the ASCII table from 0 to 127. The program uses a while loop to go through every ASCII character from 0 to 127. ASCII character from 0 to 31 are control characters and are printed specially using an array of character strings, the characters from 32 to 126 are printed … Read more

advertisement

C++ Program to Find Square Root using Math Library

This C++ program computes the square root of a number using math library. The program takes input from the standard input, computes the value and prints it. Here is the source code of the C++ program computes the square root of a number using math library. The C++ program is successfully compiled and run on … Read more

advertisement

C++ Program to Find Fibonacci Numbers using Dynamic Programming

This C++ Program demonstrates the the computation of Fibonacci Numbers using Dynamic Programming. Here is source code of the C++ Program to Find Fibonacci Numbers using Dynamic Programming. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below. /*  * C++ Program to Find Fibonacci Numbers … 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.