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.6 35 votes
Article Rating
Subscribe
Notify of
guest
25 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
zacks

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 »

Ayna

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

RAJEEV KRIPASHANKAR SAHAYA

#include <iostream>
#include <string>
#include<math.h>
using namespace std;
int main()
{
  int price=10,total,tax=1.088,weight,area_code,deliveryno;
  cout<<“\n DELIVERY CALCULATOR:”;
  cout<<“\n enter the delivery number”;
  cin>>deliveryno;
  cout<<“\n enter the weight of the package”;
  cin>>weight;
  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”;
  cin>>area_code;
  switch(area_code)
  {
    case 1:
     total=weight*price*tax*1;
     break;
     case 2:
     total=weight*price*tax*2;
     break;
     case 3:
     total=weight*price*tax*3;
     break;
      
  }
  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

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

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

for(i=a;i<=b;i++){
if(i%3==0){
++count1;
}
}

for(i=a;i<=b;i++){
if(i%5==0){
++count2;
}
}

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

return 0;

}

H&M

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.

awais

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

maria

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).

Asim

write a programme which stores different tax record of a company

Afaq

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,

jess

You are given a sequence a1, a2, …, aN. Find the smallest possible value of ai + aj, where 1 ≤ i < jN.
Input
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.
Output
A single line containing a single integer (the smallest possible sum).
Sample Input1:
Sample Input2:
4
5 1 3 4
10
9 2 7 4 5 6 3 8 1 10
Sample Output2:
Sample Output2:
4
3

jon

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 »

Ris

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 »

shahroze

. 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

BENJAMIN ADUAMOAH

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

ba2002

In this program the user has to insert two integer numbers: number1 which must be between 1 and 50 inclusive (i.e. 1<= number1 <=50) and number2 which must be between 51 and 100 inclusive (i.e. 51 <= number2 <= 100). A wrong inserted value for any number causes the output message “Invalid” to be displayed on the console and the program returns. When valid numbers are entred, they are used to in a loop that applies the following equation in each iteration: k = i * i + 2 * j. In this loop, “i” represnts a series of consecutive ascending even numbers starting with… Read more »

Rathod Gautam

can you provide some more programs of oop for better pratice and for concept clarification ?

Nittala Naga Sreeram

This website is very helpful . I’m in love with it .

Tiyas Sarkar

Supermarket is a retail facility with wide range of products under one roof, including fullgroceries and general merchandise. They satisfy the customers in all their routine shopping needs in one trip. Arun owns a supermarket in Chennai and he wanted to create a software that contains the purchase details of all the customers made on that day and at the end of the day, he wants to calculate the total amount received and the total number of items purchased by all the customers in a database. Help him to do this by writing a C++ program. Strictly adhere to the Object Oriented Specifications… Read more »

micahel ampomah

write c++ program to add two integer vectors together and store them in a third vector. the first two vectors should accepts user input for five elements each.