C++ Solved programs, problems/Examples with solutions

C++ Solved programs, problems with solutions

C++ Solved programs —->  C++ is a powerful general-purpose programming language. It is fast, portable and available in all platforms.

This page contains the C++ solved programs/examples with solutions, here we are providing most important programs on each topic. These C examples cover a wide range of programming areas in Computer Science.

Every example program includes the description of the program, C++ code as well as output of the program. All examples are compiled and tested on a Windows system.

These examples can be as simple and basic as “Hello World” program to extremely tough and advanced C++ programs. Here is the List of C++ solved programs/examples with solutions (category wise) and detailed explanation.

C++ Solved Programs by categories…….

C++ Basic Solved Programs

C++ Number Solved Programs

C++ String Solved Programs

C++ Arrays Solved Programs

C++ Functions Solved Programs

C++ Classes and Objects Solved Programs

C++ Constructor and Destructor Solved Programs

C++ Inheritance Solved Programs

C++ Overloading Solved Programs

C++ Polymorphism Solved Programs

C++ File Handling Solved Programs

C++ Template Solved Programs

If you found any error or any queries related to the above programs or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.

Thanks for reading the post….

4.5 28 votes
Article Rating
Notify of
Newest Most Voted
Inline Feedbacks
View all comments

You are tasked by Skontiri Delivery Company, to develop a system to calculate the delivery cost for their clients. Clients are charged per pounds in weight based on the delivery area code. A Provincial delivery code is 1, a National delivery code is 2 and an International delivery code is 3. The fee for the delivery is as follows: For each delivery, enter the delivery number (use as sentinel), weight and specify if the delivery is insured or not. Before you calculate the Price confirm if a valid area code is entered. Price is calculated per pounds based on the… Read more »


cout <<“Machine is working: “<< machineisworking;


#include <iostream>
#include <string>
using namespace std;
int main()
  int price=10,total,tax=1.088,weight,area_code,deliveryno;
  cout<<“\n enter the delivery number”;
  cout<<“\n enter the weight of the package”;
  cout<<“\n Enter the area code from below:\n Provincial delivery code is 1\n a National delivery code is 2\n and an International delivery code is 3.\n”;
    case 1:
     case 2:
     case 3:
  cout<<“\n the delivery fee is:”<<total;
 return 0;

Enzo Rivera

Write a program that prompts the user to enter two integers.

The program outputs how many numbers are multiples of 3 and how many numbers are multiples of 5 between the two integers (inclusive)

Parth Sachan

using namespace std;
int main()
int a,b,i,count1=0,count2=0;

cout< first integer): “<>a>>b;



cout<<"No. of multiples of 3: "<<count1<<endl;
cout<<"No. of multiples of 5: "<<count2;

return 0;



These programs are wonderful! But, the most important thing is missing is the comments! I am not saying that there should be comment for every line of code but where ever it need so. I am sure without comments, it’s not useful for students nor for anyone novice to programming! That’s why this site has less viewers.
Still, it is something that can be revised anytime.


marks in maths >= 70
marks in physics >= 65
marks in chemistry >= 60
Total marks in all three subjects >= 180

Shehwar Tanveer

Make a function bool Is_Digit (char n) which returns true,..if the character is between character 0 to 9 else, it
returns false using inline function. plz help


Write a program that creates and then reads a matrix of 4 rows and 4 columns of type int. while reading; the program should not accept values greater than 100. For any entered value greater than 100, the program should ask for input repeatedly. After reading all numbers, the system should find the largest number in the matrix and its location or index values. The program should print the largest number and its location (row and column).


write a programme which stores different tax record of a company


There is a garage where the access road can accommodate any number of trucks at
one time. The garage is build such a way that only the last truck entered can be
moved out. Each of the trucks is identified by a positive integer (a truck_id).
Write a program to handle truck moves, allowing for the following commands:
a) On_road (truck_id) b) Enter_garage (truck_ id)
c) Exit_garage (truck_id) d) Show_trucks (garage )
e) Show_trucks(road) f) user menu for function calling

Arthur Mark

Good day everyone, please i would like to know how to write a nested if program following a step by step process;
payment of fees
admission letter
online registration
identification card
an allocated hall of residence
Please i will need all the help i can get, i am a computer science student and i am having little problems with this… please can i get the information sent to my provided gmail account. THANK YOU SO MUCH FOR YOUR FURTHER ASSISTANCE IT NEEDS TO BE SUBMITTED IN LESS THAN 12 HOURS ALL THE HELP I WILL GET WOULD BE NEEDED,


You are given a sequence a1, a2, …, aN. Find the smallest possible value of ai + aj, where 1 ≤ i < jN.
The first line of each description consists of a single integer N.
The second line of each description contains N space separated integers – a1, a2, …, aN respectively.
A single line containing a single integer (the smallest possible sum).
Sample Input1:
Sample Input2:
5 1 3 4
9 2 7 4 5 6 3 8 1 10
Sample Output2:
Sample Output2:


Write a C++ program to calculate the tuition fee for a student at a University. The program should prompt for and accept the idnumber and the total number of credits for which he/she has enrolled. The bill outputted should contain the idnumber and tuition fee. Calculate the tuition fee as follows: • Total credits of 15 or more indicates that the student is full-time. Full-time students pay a flat rate of $35,000 for tuition. • Total credits of less than 15 indicate that the student is part-time. Part-time students pay $850 per credit for tuition. After printing the tuition fee,… Read more »


Write a program to display only months, but with a forward/backward button to move bw the months from January to December

sowmiya Prakash

Welcome   A recently launched attraction at the “Events Square” entertainment fair is the “Carnival of Terror” which is an interactive fun zone featuring scary, horror and Halloween stories.   The Entry tickets for the show is to be printed with a Welcome message along with an additional message for Children stating they should be accompanied by an adult. Given the age of the person visiting the scary house, the ticket should carry the additional message only for Children whose age is less than 15 years. The show organizers wanted your help to accomplish this task. Write a program that… Read more »


. include new functions of
-print a single node
-print entire list
search a node by, name, id, cnic, dob (function overload…one function per filter)
insert at head
-insert at tail


The management of Lifetime Company Limited decided to pay a bonus of 4.3% of total sales to every salesperson of the company who made total sales of GHS 5000 or more in six (6) months. Write a C++ program to accept the monthly sales of each salesperson and display whether the person deserve a bonus or not.

cyiza gisele

hello programmer

Abdul Rauf

Find Second Maximum Number(using operators &&, >, <)
Write a program which takes 3 input integers and tell the 2nd maximum. Sample Input :
90 5 60
Sample Output