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++ Program to Print Number (Entered by the User)
- C++ Program to Addition of Two Numbers
- C++ Program to Find Quotient and Remainder
- C++ Program to Swap Two Numbers Without Using third variable
- C++ Program to Find Size of int, float, double and char
- C++ Program to Multiply two Numbers
- C++ Program to Find ASCII Value of a Character
- C++ program to generate random numbers
- C++ Program to calculate sum and average of three numbers
- C++ Program to convert inches into yard, feet and inches
- C++ Program to raise any number X to power N
- C++ Program to Add Two Numbers
- C++ Program to Convert Days Into Years, Weeks and Days
- C++ Program to find Square Root of a number
- C++ Program to find Compound Interest
- C++ program to find cube of number using macros
- C++ Program to Check Number is Odd or Even
- C++ Program to Check Character is Uppercase, Lowercase, Digit or Special Character
- C++ Program to Check whether year is Leap year or not
- C++ Program to Find All Roots of a Quadratic Equation
- C++ Program to Check Whether a character is Vowel or Consonant
- C++ Program to Check given number is Even or Odd
- C++ Program to Check given number is Prime number or not
- C++ Program to find Factorial of a Number
- C++ program to Print Table of any Number
- C++ Program to Reverse a Number
- C++ Program to Find number of Digits in any number
- C++ Program to find Fibonacci Series
- C++ Program to Check given number is Armstrong or Not
- C++ program to Find Largest Number among three numbers
- C++ program to Check Number is Palindrome or not
- C++ Program to Find HCF of two numbers
- C++ program to find LCM of two numbers
- C++ program to find Square Root of a Number
- C++ Program to find Cube Root of Number
- C++ program to find sum of digits of a number
- C++ Program to Find Power of Number
- C++ Program to find average of numbers
- C++ Program for Pascal Triangle
C++ Number Solved Programs
- C++ Program to calculate sum and average of three numbers
- C++ Program to raise any number X to power N
- C++ Program to Add Two Numbers
- C++ Program to find Square Root of a number
- C++ Program to Check given number is Even or Odd
- C++ Program to Check given number is Prime number or not
- C++ Program to find Factorial of a Number
- C++ program to Print Table of any Number
- C++ Program to Reverse a Number
- C++ Program to Find number of Digits in any number
- C++ Program to find Fibonacci Series
- C++ Program to Check given number is Armstrong or Not
- C++ program to Find Largest Number among three numbers
- C++ program to Check Number is Palindrome or not
- C++ Program to Find HCF of two numbers
- C++ program to find LCM of two numbers
- C++ program to find Square Root of a Number
- C++ Program to find Cube Root of Number
- C++ program to find sum of digits of a number
- C++ Program to Find Power of Number
- C++ Program to Check Number is Unique Number or Not
- C++ Program to find average of numbers
- C++ Program to Find Sum of First n Natural Numbers
- C++ Program to Find Divisors of a Number
- C++ Program to Find Sum of Square of n Natural Numbers
- C++ Program to Convert Binary to Decimal
- C++ Program to Convert Decimal to Binary
- C++ Program to Display Prime Numbers Between Two Intervals
- C++ Program to Convert Binary Number to Octal
- C++ Program to Convert Octal to Binary
- C++ Program to Convert Octal Number to Decimal
- C++ Program to Convert Decimal Number to Octal
- C++ Program to Make a Simple Calculator
- C++ program to find area of circle
- C++ Program to find Area and Perimeter of Rectangle
- C++ Program to find Perfect Number
- C++ Program to Calculate Grade of Student
- C++ Program to Calculate Arithmetic Mean
- C++ Program to Calculate Average Percentage Marks
C++ String Solved Programs
- C++ Program to Print entered String
- C++ Program to Find Frequency of Characters in String
- C++ program to Find Length of String
- C++ Program to Compare Two Strings
- C++ Program to Reverse String
- C++ program to concatenate two string
- C++ Program to Copy String into Another String
- C++ Program to Find Number of Vowels, Consonants, Digits, Spaces in String
- C++ Program to Remove Characters in String Except Alphabets
- C++ Program to Sort Elements in Lexicographical Order
- C++ Program to Swap Two Strings
- C++ Program to Convert Lowercase to Uppercase
- C++ Program to Convert Uppercase Character to Lowercase
- C++ Program to Convert Uppercase String to Lowercase
- C++ Program to Remove Spaces from String
- C++ Program to Count Words in String
- C++ Program to Delete Words from String
- C++ Program to Delete Vowels from String
- C++ Program to Find Substring in String
- C++ Program for Permutation of String
- C++ Program to reverse all strings stored in an array
- C++ Program to Convert first alphabet from lowercase to uppercase
- C++ Program to check whether String is Palindrome or not
- C++ Program to convert first letter of each word to uppercase and other to lowercase
C++ Arrays Solved Programs
- C++ Program to Remove Characters in String Except Alphabets
- C++ Program to find Maximum or Largest number in array
- C++ Program to enter 5 numbers & display first and last only
- C++ Program To reverse an array elements entered by user
- C++ Program to Sort an Array Elements in Ascending Order
- C++ Program to Sort an Array Elements in Descending Order
- C++ Program for Addition of two matrix
- C++ Program to Find Duplicate Elements in Array
- C++ Program to Find Sum of Elements of an Array
- C++ Program to Reverse elements of an Array
- C++ Program to Find Even & Odd Elements in Array
- C++ Program to Delete element from Array
- C++ program to Insert element at specific position in array
- C++ Program to Pass Array in Function
- C++ Program for Three Dimensional (3D) Array
- C++ Program for Two Dimensional Array
- C++ Program to Delete Element from Array
- C++ Program to Find Smallest Element in Array
- C++ Program to Find Largest Element in Array
- C++Program for One Dimensional (1-D) Array
- C++ Program to Calculate Average of elements in an Arrays
- C++ Program to Access Elements of an Array Using Pointer
- C++ Program to Multiply Two Matrix Using Multi-dimensional Arrays
- C++ Program to Find Transpose of a Matrix
- C++ Program to Subtract Two Matrices
- C++ Program for Quick Sort using arrays
- C++ Program for Shell Sort using Arrays
- C++ Program for Union of Two Sorted Arrays
- C++ Program for Union of Two Unsorted Arrays
- C++ Program for Insertion Sort using Array
- C++ Program for Selection Sort using Arrays
- C++ Program to Find Largest and Smallest Element of a Matrix
- C++ Program for Binary Search in Arrays
- C++ Program for Linear Search in Arrays
- C++ Program to Find Sum of Diagonals of Matrix
- C++ Program to Print Lowerhalf and Upperhalf of Triangle Matrix
- C++ Program to Find Sum Above and Below of Main Diagonal Matrix
- C++ Menu Driven Program for Queue Operations using Arrays
- C++ Menu Driven Program for Stack Operations Using Arrays
- C++ Program to implement Merge Sort using Divide and Conquer Algorithm
C++ Functions Solved Programs
- C++ Program for Linear search using recursion
- C++ Program to Find Factorial of Number Using Recursion
- C++ program to Find Sum of Natural Numbers using Recursion
- C++ program to Check Number can Express as Sum of Prime Numbers
- C++ Program to Check Prime Number
- C++ Program to Display Prime Numbers Between Two Intervals
- C++ Program to Find GCD Using Recursion
- C++ Program to Find Power Using Recursion
- C++ program to Reverse String Using Recursion
- C++ Program to Convert Binary Number to Octal
- C++Program to Convert Octal to Binary
- C++ Program to Convert Octal Number to Decimal
- C++ Program to Convert Decimal Number to Octal
- C++ Program to Convert Binary Number to Decimal
- C++ Program to convert decimal number to binary
- C++ Program for Fibonacci Series Using Recursion
- C++ program to swap values using pass by reference
- C++ Program to print series using function: x + x^3/3! + x^5/5! +…….+ x^n/n!
- C++ Program for Addition,subtraction and multiplication using function
- C++ Program to find cube of number using function
- C++ program to find greatest between two numbers using inline function
- C++ program to find factorial by defining functions outside the class
- C++ program to find greatest b/w 3 nos. by defining the functions inside class
- C++ program to swap two characters and integers by call by value
- C++ program to find reverse of number by defining functions outside class
- C++ program to swap 2 characaters and integers by call by address
- C++ program to find sum and product of 5 numbers using inline function
- C++ program to add two time by Call by reference
- C++ program to add two time by Call by address
- C++ program to find how many times function called by objects
- C++ program to find square of float and integer using inline function
- C++ program to add two complex number passing objects as arguments
- C++ program to find factorial of number using functions
- C++ program to check number is palindrome or not using Function
- C++ Program to Swap two numbers using call by value
- C++ Program to Swap two numbers by call by address
- C++ Program to Swap two numbers by call by reference
C++ Classes and Objects Solved Programs
- C++ program to find factorial by defining functions outside the class
- C++ program to find greatest b/w 3 nos. by defining the functions inside class
- C++ program to find reverse of number by defining functions outside class
- C++ program to add two time by Call by reference
- C++ program to add two time by Call by address
- C++ program to find how many times function called by objects
- C++ program to find square of float and integer using inline function
- C++ program to add two complex number passing objects as arguments
- C++ Program to display entered Date
- C++ program to display Student details using class
- C++ Program to find Largest among 3 numbers using classes
- C++ Program to find Sum of odd numbers between 1 and 100 using class
- C++ program to display Entered Time using class
- C++ program to find Largest among 2 numbers using class
- C++ program to Swap two numbers using class
- C++ program for various Mathematical Operations using Switch case
- C++ Program to Compare Two Strings using overloading
- C++ Program to enter student marks and roll no. using Virtual Class
- C++ Program to Print Numbers From 1 to n using class
- C++ Program to calculate Volume of Cube using constructor and destructor
- C++ Program to Perform Complex Operations using Overloading
- C++ Program to determine the Area of Rectangle using constructors
- C++ Program to show Constructor & Destructor Example
- C++ Program to Show Counter using Constructors
- C++ Program to Display Date using Constructors
- C++ program to Display Student Details using constructor and destructor
- C++ Program to enter student details by Passing parameters to constructors
- C++ Program to Show Overload Constructor Example
- C++ Program to show Example of Default copy constructor
- C++ Program to demonstrate Constructor Overloading
- C++ Program To calculate Volume of Box using Constructor
- C++ Program To Calculate Simple Interest using class
- C++ Program To Calculate Electricity Bill Of Person using Class
- C++ program to multiply every member by 10 using class
- C++ program for Simple Queue using Class
- C++ Program to implement B- Trees using Linked Lists
C++ Constructor and Destructor Solved Programs
- C++ Program to calculate Volume of Cube using constructor and destructor
- C++ Program to Perform Complex Operations using Overloading
- C++ Program to determine the Area of Rectangle using constructors
- C++ Program to show Constructor & Destructor Example
- C++ Program to Show Counter using Constructors
- C++ Program to Display Date using Constructors
- C++ program to Display Student Details using constructor and destructor
- C++ Program to enter student details by Passing parameters to constructors
- C++ Program to Show Overload Constructor Example
- C++ Program to show Example of Default copy constructor
- C++ Program to Show an Example of Destructor
- C++ Program to Show an Example demonstrating Order of constructor invocation
- C++ Program to demonstrate Constructor Overloading
- C++ Program To calculate Volume of Box using Constructor
- C++ Program For Constructor with Two Parameters
- C++ Program to illustrates the use of Constructors in single inheritance
- C++ Program to illustrates the use of Constructors in multilevel inheritance
C++ Inheritance Solved Programs
- C++ Program to access protected data member using Inheritance
- C++ Program for Inheritance Beyond Single Level
- C++ Program for enter Patient details using Inheritance
- C++ program to demonstrate an example of Single Inheritance
- C++ Program to demonstrate an Example of Multiple Inheritance
- C++ Program to demonstrate an Example of Hybrid Inheritance
- C++ program display student marksheet using multiple inheritance
- C++ Program to find Area of Rectangle using inheritance
- C++ Program to show access to private,public and protected using Inheritance
- C++ Program to Overriding the member functions using Inheritance
- C++ Program to enter Student details of different Stream using Hierarchical Inheritance
- C++ Program to find area and volume using multiple inheritance
- C++ Program to demonstrate an Example of Multilevel Inheritance
- C++ Program to illustrates the use of Constructors in single inheritance
- C++ Program to illustrates the use of Constructors in multilevel inheritance
- C++ Program to illustrates the use of Constructors in multiple inheritance
- C++ Program of templated class derived from non-templated class
- C++ Program of non-templated class derived from templated base class
- C++ Program of templated class derived from another templated class
C++ Overloading Solved Programs
- C++ Program to Compare Two Strings using overloading
- C++ Program to Perform Complex Operations using Overloading
- C++ program to Swap variables using function overloading
- C++ program for show Counter using Overloading unary operator ++
- C++ program to perform operations on complex numbers
- C++ class Program to perform rational number arithmetic
- C++ class Program to perform Complex Arithmetic using operator overloading
- C++ Program to Find the Area of shapes using function overloading
- C++ Program to check Palindrome using function overloading
- C++ program to find area of square,rectangle,circle and triangle
- C++ program to find volume of cube, cylinder, sphere by function overloading
C++ Polymorphism Solved Programs
- C++ Program to demonstrate Run time polymorphism
- C++ Program to illustrate the use of pure virtual function in Polymorphism
- C++ Program to define an Abstract Class in Polymorphism
- C++ Program to illustrates the use of Virtual base class
- C++ Program to show an Example of Pointers to base class
- C++ Program to illustrate Abstract Base Class
- C++ Program to illustrate an example of Pure Virtual functions
- C++ Program to maintain employee database using virtual class
C++ File Handling Solved Programs
- C++ Program to Maintain Book Record using File Handling
- C++ Program to Maintain House Records using File Handling
- C++ Program for Registration(Signup) process using File Handling
- C++ Program to Read and Write File Operation in File Handling
- C++ Menu Driven Program to perform Add,Modify,Append and Display
- C++ Program to Store or Enter Data to file using File Handling
- C++ Program to Retrieve information from the file using File Handling
- C++ Program to Read and Display file using File Handling
- C++ Program to Merge Two Files to Third File using File Handling
- C++ Program to Encrypt Files using File Handling
- C++ Program to Decrypt Files using File Handling
- C++ program to read and write values through object using File Handling
- C++ Program to Count Digits, Alphabates & Spaces using File Handling
- C++ Program to Count Words, Lines and Total Size using File Handling
- C++ Program to read text file and write in another text file in File Handling
- C++ Program to Count Occurrence of Word using File Handling
- C++ Program to Read Write Student Details using File Handling
- C++ Program of Manipulation of file pointers in File Handling
C++ Template Solved Programs
- C++ Program to find Largest among two numbers using function template
- C++ Program to Swap data using function template
- C++ Program to build Simple calculator using Class template
- C++ Program to demonstrate an Example of Template specialization
- C++ Program to demonstrate an Example of Non-type parameters for templates
- C++ Program to implement Generic methods on Stack using Class Template
- C++ Program to implement push & pop methods from stack using template
- C++ Program to Add two numbers using function template
- C++ program to find Sum of numbers using Overload template function
- C++ Program to Perform Simple Addition Function Using Templates
- C++ Program to find sum of Array using function template
- C++ Program to find Square function of each data-type using single template
- C++ Program of square function using template specialization
- C++ Program to show Example of Static member variable of template class
- C++ Program of templated class derived from non-templated class
- C++ Program of non-templated class derived from templated base class
- C++ Program of templated class derived from another templated class
- C++ Menu Driven Program for Stack using Templates
- C++ program to implement Hash Table using Template Class
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….
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 »
Hi please i am help me soultion plz
#include <iostream> #include <string> double calculatePrice(int areaCode, double weight) { double feePerPound; switch (areaCode) { case 1: feePerPound = 1.5; break; case 2: feePerPound = 2.5; break; case 3: feePerPound = 4.0; break; default: std::cout << “Invalid area code” << std::endl; return 0.0; } return feePerPound * weight; } double calculateTax(double price) { const double taxRate = 0.1; return price * taxRate; } double calculateInsurance(double price, bool insured) { const double insuranceRate = 0.05; if (insured) { return price * insuranceRate; } return 0.0; } int main() { std::string areaName; int deliveryNumber, areaCode; double weight, price, tax, insurance, total, grandTotal = 0.0;… Read more »
cout <<“Machine is working: “<< machineisworking;
#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;
}
#include <iostream>
//#include <string>
//#include<math.h>
using namespace std;
int main()
{
int price=10;
int tax=2;
int total,weight,area_code,deliveryno;
cout<<“DELIVERY CALCULATOR:“;
cout<<“ enter the delivery number“<<endl;
cin>>deliveryno;
cout<<“enter the weight of the package“<<endl;
cin>>weight;
cout<< “ Enter the area code from below: Provincial delivery code is 1 a National delivery code is 2 and an International delivery code is 3.“<<endl;
cin>>area_code;
switch(area_code)
{
case 1:
total=weight*price*tax*deliveryno;
break;
case 2:
total=weight*price*tax*deliveryno;
break;
case 3:
total=weight*price*tax*deliveryno;
break;
}
cout<<“ the delivery fee is:“<<total;
return 0;
}
sorry
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)
#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;
}
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
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
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 < j ≤ N.
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
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 »
#include<iostream> using namespace std; class Student{ public: string regNo; int noOfcredits; double tBill; string status1 = “Full-time”; string status2 = “Part-time”; string answer; }; isBool(string answer){ if(answer == “yes”){ return true; }else if(answer == “no”){ return false; } } int main() { Student stud1,stud2; stud1.regNo; cout << “Enter registration number: ” ; getline(cin, stud1.regNo); stud1.noOfcredits; cout << “Enter number of credits: ” ; cin >> stud1.noOfcredits; isBool(stud1.answer); stud1.tBill; if(stud1.noOfcredits > 15){ cout << “Status: “<< stud1.status1 ; cout << “\nTution fee: $35,000 “; cout << “\nCalculate tution fee for another student? “; cin >> stud1.answer; }else{ cout << “Status: “<< stud1.status2… Read more »
Write a program to display only months, but with a forward/backward button to move bw the months from January to December
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<iostream>
using namespace std;
class Child{
public:
string name;
int age;
};
int main()
{
Child child1;
cout << “Enter child’s first name: “;
cin >> child1.name;
cout << “Enter age: “;
cin >> child1.age;
if(child1.age > 15){
cout << child1.name << ” welcome to Carnival of Terror..”<< endl;
}else{
cout << child1.name << ” welcome to Carnival of Terror..”<< endl;
cout << “Please note that you should be accompanied by an adult..”<< endl;
}
return 0;
}
galat program hai
. 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.
hello programmer
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
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 »
can you provide some more programs of oop for better pratice and for concept clarification ?
This website is very helpful . I’m in love with it .
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 »
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.
The representation of a complex number as a sum of a real and imaginary number, z = x + i y, is called its Cartesian representation. We can therefore express any complex number z = x + i y into , this representation is known polar representation of any complex number z. where and You need to create a class having name, Polar Representation with data members, magnitude and angle. Make sure you provide a default constructor too. Overload following operators of the class; 1. + operator (to add two objects of class) 2. – operator (to subtract two objects of class) 3. * operator (to multiply… Read more »
please help me
. Write a “Garage” class that has a “Car” that is having troubles with its “Motor”. Use a function-level try block in the “Garage” class constructor to catch an exception (thrown from the “Motor” class) when its “Car” object is initialized. Throw a different exception from the body of the “Garage” constructor s handler and catch it in main( ).
Write a program that asks the user to enter the number of courses he/she is taking and then enter the course code and its number of credits. The program should sum the total number of credits and display it.
Create publisher class that represents a book publisher, publisher has two properties/attributes name and a code which should be a non-negative integer. Class must have a constructor that should take parameters to set the both properties, get functions for both attributes, a set method to change name. and a print function to print/display the publisher. now create a main function make and object of publisher, print the publisher then change the publisher code and again print the publisher. your program should run like this
the old publisher
the new publisher
Define a class named ‘Train’ representing following members:
Data members :- – Train Number
– Train Name
– Source
– Destination
– Journey Date
– Capacity
Member functions:
– Initialise members
– Input Train data
– Display data
Write a C++ program to test the train class.
Develop a geometry calculator that will do the following things:
1. It should give the user many options to choose between (user should right 1 if
he/she wants to calculate something related to circle, 2 for rectangle and so on).
Like
1. Circle
1. Area
2. Circumference
2. Rectangle
1. area
3. Triangle
1. Area
2. base
4. Parallelogram
1. Area
5. Trapezoid
1. Area
2. Each of these operations must be handled by a function
3. You should use call by value, call by reference with pointers in any of these
functions
Your task is to create a program that examines the distribution grades on an exam. Ask the user to input how many students does he have followed by the grades of those students. Then, group the grades depending on the range and then display the summary in a bar graph format. The ranges are as follows: 0 – 9, 10 – 19, 20 – 29, 30 – 39, 40 – 49, 50 – 59, 60 – 69, 70 – 79, 80 – 89, 90 – 99, and 100.
A company has three types of employee: 1. Managers: receive a fixed monthly salary 2. Commission Workers: receive $1000 plus 5% of their gross monthly sales 3. Piece Workers: receive a fixed amount of money per item for each of the items they produce; each pieceworker in this company works on only one type of item. Write a program to compute the monthly pay for each employee. P.S: You do not know the number of employees in advance. Each type of employee has its own pay code: Managers have code 1 Commission Workers have code 2 Pieceworkers… Read more »
write a program
1) Declare all variables and constants paying attention to the types
2) Calculate the area of the circle given the radius
3) Divide the area of the circle by the number of segments, but only if this number is different from zero
4) Print all partial results
Overload the ‘subscript’ operator for the class ‘String’ so that it takes a
character as a parameter and returns the position of its first occurrence.
The output of the following code should be two.
String s1(“abcd”);
cout<<s1[‘c’]<<endl;
Also, overload ‘+’ operator to merge two strings.
Create an menu-driven program.
1. Find
2. Merge
3. Exit
plz help me
s]
Write a program to process the quote Four Score and Seven Years Ago. Copy the quotation into a string. Create three character arrays – one for vowels, one for consonants and one for reverse order. The program will copy the vowels into the vowels array, the consonants into the consonants array and the reverse order quote into the reverse array. For example, if the string were “hello world”: • The vowels array would equal ‘e’, ‘o’, ‘o’ • The consonants array would equal ‘h’, ‘l’, ‘l’, ‘w’, ‘r’, ‘l’, ‘d’ • The reverse array would equal ‘d’, ‘l’, ‘r’, ‘o’,… Read more »
1) Prompts the user to enter from the keyboard car price and profit percentage. (Both are float). 2) Calculates the total price using car price and profit percentage. For example, if the car price is 100 BD and profit percentage is 25%, then the total price is 125 BD. 3) Display the value of car price, profit percentage, total price. Each in separate line formatted in two decimal places. Sample Input/output (Input in red color)
whats my problem
#include<iostream>
using namespace std ;
int main()
{
cout<<“Fahadvai” ;
return 0 :
}
help
problem?
Write a program to display your name 500 times
Write a program to accept any number and check whether the number is even or odd
Using switch case statement accept any two numbers and display sum, product or difference according to the user’s choice. An appropriate message should be displayed for the wrong choice
Write a program to accept any positive integer and display its square. i.e. if the input is 5 then the output should be 25. Program will exit only if user enters less than or equals to 0
#include<iostream>
using namespace std;
int main()
{
/*Write a program to accept any positive integer and display its square.
i.e. if the input is 5 then the output should be 25.
Program will exit only if user enters less than or equals to 0 */
int num;
cout<< “Enter any number :”;
cin>>num;
if( num<0)
exit(0);
else
cout<<num<< ” it’s square is “<<num*num<<endl;
return 0;
}
Write a program to accept any number and display the sum of its factors.*
The programme below in C++ is given to you. Complete the Binnary Search function so as to work properly with a head and tail pointer and return whether value x is included in the table or not. Assume that the table already has all its elements in ascending order. // Example program #include #include using namespace std; void filltable(int *p){ for (int i=0; i<5; i++){ cout <> *p; p++; } } void printtable(int *pr){ for (int i=0; i<5; i++){ cout << *pr <<" "; pr++; } } void findx(int *p, int x){… Read more »
Write a c++ program to perform following operations:
Create a class with following Data Members and Member Functions:
• Data Members : JavaMarks and CPPMarks
• Member Functions:
◦ Constructor() – Create a constructor to initalize the data
members
◦ Overload the binary + operator using Friend Function
◦ Display() – Display the data
◦ Call the Destructor at the end of the code
Input:
Output:
– The same string (X) , but modified as the following:
o Find some word that
start with (L1) , and
end with the letter (L2).
o Copy the founded word to the last of the array but in reverse manner.
Example:
L1 = ‘S’
L2 = ‘L’
w
e
h
i
s
SS
C
H
O
O
LL
y
e
s
c
o
m
e
‘\0’
x[]= we his school yes come loohcs ‘\0’
how can i solve it
write a C++ program to find number of similar words between 5 text files and 1 source file one by one, and common phrases among the these files
i like that you have variety of questions.
hi I want code of that program
s= y/(x+1)! +y/(x+2)! +y/(x+3)! +…. y/(x+n)!