Skip to content

🦕 C++ Programming & Introduction to Computer Science. You can find Lab Assignments and solutions, interesting C++ programs, and lots of different resources to start learning coding with C++.

Rustam-Z/cpp-programming

Repository files navigation

C++ Programming

Contents

Keep These Tips in Mind While Learning Programming

1. Learn and code every day, consistency is important.
2. Write it down - plan your code before you start coding and understand the input to your program and the output from your code.
3. Learn to debug your code - look at the code line by line to see how it works.
4. Surround yourself with other people who are learning. Teach each other.
5. Learn taking notes.
6. Build something, anything you would enjoy while coding. Be unique.
7. Focus on 1 thing! Take small steps, but every day, consistency is very important again.
8. Learn to ask GOOD questions to others:
  - G: Give context on what you are trying to do, clearly describing the problem.
  - O: Outline the things you have already tried to fix the issue.
  - O: Offer your best guess as to what the problem might be. It helps the person who is helping you not only know what you're thinking but also know that you've thought of something yourself.
  - D: Demonstrate what's going on. Include the code, the tracing error message, and an explanation of the steps you followed that resulted in the error. That way, the person helping doesn't have to try to recreate the problem.

Computer Science Basics

Learning Resources

Problem Solving

  1. C++ Program to print "Hello, World!".

  2. C++ Program to print an integer entered by the user.

  3. C++ Program to Add/Subtract/Multiply/Divide Two Integers.

  4. C++ Program to Add/Subtract/Multiply/Divide Two Integers entered by the user.

  5. C++ Program to Add/Subtract/Multiply/Divide two Floating Point Numbers.

  6. C++ Program to Compute Quotient and Remainder.

  7. C++ Program to Calculate the Area and Circumference of a Circle.

  8. C++ Program to Calculate the Area of a Scalene Triangle.

  9. C++ Program to Calculate the Area of an Equilateral Triangle.

  10. C++ Program to Calculate the Area of Right Angle Triangle.

  11. C++ Program to Calculate the Area and Perimeter of a Rectangle.

  12. C++ Program to Calculate the Area and Perimeter of a Square.

  13. C++ Program to Find ASCII Value of a Character.

  14. C++ Program to Find the Size of int, float, double, and char.

  15. C++ Program to Swap Two Numbers.

  16. C++ program that converts between Celsius and Fahrenheit temperatures based on user input. You can also add conversions for Kelvin.

  17. C++ Program to Check Whether a Number is Even or Odd.

  18. C++ Program to Check Whether a Number is Positive or Negative.

  19. C++ Program to Check Whether a Character is a Vowel or Consonant.

  20. C++ Program to find the Largest Number Among Three Numbers.

  21. C++ Program to find if the entered year is a leap year or not.

  22. C++ program that allows the user to perform basic arithmetic operations (addition, subtraction, multiplication, division) on two numbers. You can also add error handling for division by zero.

  23. BMI Calculator: Create a program that calculates a person's Body Mass Index (BMI) based on their weight and height input. Provide a classification of whether the person is underweight, normal weight, overweight, or obese. Use cin, cout. Formula: bmi = weight / (height * height)

    bmi < 18.5 Underweight
    bmi < 24.9 Normal Weight
    bmi < 29.9 Overweight
    Otherwise Obese
  24. Nested condition

    • Get the age and membership_status as user input. membership_status can be only Y or y. So, if the age is bigger or equal to 18 and if the user is a member of our shop, we provide a 10% discount, else we charge fully.
    • Write a simple chatbot program using nested conditions.
  25. Write a program to calculate taxes, with the following conditions:

    • If the salary is less than $1500, then there are no taxes
    • If the salary is from 1501 to 3000 $ (1501<= salary < 3000) then the tax should be 10%
    • If the salary is from 3001 to 5000 $ (3001 <= salary < 5000) then the tax should be 20%
    • If the salary is above $5000, then the tax should be 30%

    Hint: Formula for finding tax (salary * percentage) / 100

    You must output:

    • Tax percentage
    • Salary after taxes
  26. Switch:

    • Program to use switch statement. Display Monday to Sunday.
    • Program to display arithmetic operator using switch case.
  27. C++ Program to Find all Roots of a Quadratic equation.

  28. C++ Program to Check Whether a Character is an Alphabet or not.

  29. C++ Program to Calculate the Sum of Natural Numbers.

  30. Program to calculate the sum of numbers from m to n.

    • Hint: Input two numbers m and n. Find the sum of all numbers from m to n. For example m=3 and n=8 then sum will be 3 + 4 + 5 + 6 + 7 + 8 = 33.
  31. Program to print Fibonacci series up to 100.

    • Hint: Fibonacci Series is 1, 1, 2, 3, 5, 8, 13, 21, ...
  32. C++ program to print Even numbers up to 100.

  33. C++ program to Generate a Multiplication Table.

  34. C++ program to Calculate the Power of a Number.

  35. Factorial Calculator: Write a program that calculates the factorial of a given positive integer. Factorial of a number is the product of all positive integers from 1 to that number.

  36. Prime Number Checker: Create a program that determines whether a given number is prime or not. A prime number is a positive integer greater than 1 that has no positive divisors other than 1 and itself.

  37. C++ Program to Display Prime Numbers Between Two Intervals.

  38. Program to print stars Sequence1.

    *
    **
    ***
    ****
    *****
  39. Program to print stars Sequence2.

        *
       ** 
      ***
     ****
    *****
  40. Program to print star Sequences3.

      *
     ***
    *****
  41. Program to print Sequence4.

    *
    **
    ***
    ****
    *****
    *****
    ****
    ***
    **
    *
  42. Sum of Numbers: Write a program that prompts the user for an integer n and then calculates the sum of all integers from 1 to n using a for or while loop. Also, calculate the sum of all even and odd numbers.

  43. Guess the Number Game: Create a simple game where the program picks a number (int number = 42;), and the user has to guess the number, receiving hints (higher or lower). Use a while loop to handle the game process. If the user guesses the number, stop the program and display the number of attempts made by the user.

  44. User Menu Interaction: Create a text menu that provides the user with several options (e.g., "1. Perform action 1", "2. Perform action 2," and so on). Use a while loop to continue the program until the user chooses the exit option (system("exit");).

  45. Program to display the series and find the sum of 1 + 3 + 5 + ... + n.

  46. Program to display the sum of the series 1 + 1/2 + 1/3 + ... + 1/n.

  47. Write a program to add the first seven terms of the following series using a for loop: 1/1! + 2/2! + 3/3! + ...

  48. C++ Program to Find GCD of Two Numbers.

  49. C++ Program to Find LCM of Two Numbers.

  50. C++ Program to Display Characters from A to Z Using Loop.

  51. C++ Program to Count Number of Digits in an Integer.

  52. C++ Program to Reverse a Number.

  53. C++ Program to Calculate the Power of a Number.

  54. C++ Program to Check Whether a Number is Palindrome or Not.

  55. C++ Program to Check Armstrong Number.

  56. C++ Program to Display Armstrong Number Between Two Intervals.

  57. C++ Program to Convert Binary Number to Decimal and vice-versa.

  58. C++ Program to Convert Octal Number to Decimal and vice-versa.

  59. C++ Program to Convert Binary Numbers to Octal and vice-versa.

  60. C++ Program to Reverse a Sentence using recursion function.

  61. C++ Program to calculate the power using recursion function.

  62. Build a program for calculating the area and perimeter of various geometric shapes (circle, rectangle, triangle, etc.) using separate functions for each shape.

  63. Simple Calculator Program: Create a program that acts as a basic calculator, allowing users to perform addition, subtraction, multiplication, and division. Use functions for each operation.

  64. Write a program to swap two values using functions.

  65. Write a program to convert time to minutes using functions. (input 3 variables namely hours, minutes, and seconds. Convert everything into minutes.)

  66. Write a program to sum the Fibonacci series up to n (input n). 1, 1, 2, 3, 5, 8, 13,

  67. Function Overloading and Default Arguments: Build a program for calculating the area and perimeter of various geometric shapes (circle, rectangle, triangle, etc.) using separate functions for each shape. Overload functions for shapes with different parameters.

  68. Employee Payroll: ****Design a program that calculates employee payroll, including basic salary, overtime pay, and deductions. Use functions to compute each component.

  69. Temperature in °C can be converted to °F using this formula: °F = (°C x 9/5) + 32. Write a function which converts °C to °F, convert_celsius_to-fahrenheit.

  70. Write a function called check-season, it takes a month parameter and returns the season: Autumn, Winter, Spring or Summer.

  71. Write a function called calculate_slope which return the slope of a linear equation.

  72. Student Grade Tracker: Create a program that allows teachers to enter student grades and calculate averages, find the highest and lowest scores, and display statistics.

  73. Library Management System: Create a simple library management system where you can store and manage a list of books using arrays. Ask the user to enter the book names. You should have the function display the book names. Create a void function. You should have the functionality to update the book name. To do this create another function. And pass index as argument.

  74. Write a function to merge two arrays.

  75. Write a function to search the value in the array and return its index, if the value is not found print “Item not found”.

  76. Number Sorting: Write a program that reads a list of numbers into an array and sorts them in ascending or descending order using a sorting algorithm.

  77. Matrix Operations: Write a program for basic matrix operations, such as addition, subtraction, multiplication, and transposition.

  78. In a small company, there are five salesmen. Each salesman is supposed to sell three products. Write a program using a 2D array to print (Input from user). The total sales by each salesman and Total sales of each item.

  79. C++ Program to Calculate Standard Deviation.

  80. C++ Program to Access Elements of an Array Using Pointer.

  81. Write a program that declares an integer variable, assigns a value to it, and then uses a pointer to print the value.

  82. Swap the values of two integer variables using pointers.

  83. Write a program that finds the sum of elements in an integer array using a pointer.

  84. Create a dynamic integer array and prompt the user for the array size. Fill the array with user input values.

  85. C++ Program to Find Largest Number Using Dynamic Memory Allocation.

  86. C++ Program to Find the Frequency of Characters in a String.

  87. C++ Program to count the number of vowels, consonants, and so on.

  88. C++ Program to Remove all Characters in a String Except Alphabet.

  89. C++ Program to Find the Length of a String.

  90. C++ Program to Concatenate Two Strings.

  91. C++ Program to Copy String Without Using strcpy().

  92. C++ Program to Sort Elements in Lexicographical Order (Dictionary Order).

  93. C++ Program to Store Information(name, roll, and marks) of a Student Using Structure.

  94. C++ Program to Add Two Distances (in inch-feet) System Using Structures.

  95. C++ Program to Add Two Complex Numbers by Passing Structure to a Function.

  96. C++ Program to Calculate Difference Between Two Time Periods.

  97. C++ Program to Store Information of Students Using Structure.

  98. C++ Program to Store Information Using Structures with Dynamically Memory Allocation.

  99. C++ Program to Write a Sentence to a File.

  100. C++ Program to Read a Line From a File and Display it.

  101. C++ Program to Display its own Source Code as Output.

  102. [OOP] Define a class called Car with attributes like model, and year. Create an object of the Car class and set its attributes. Then, print out the car's details.

  103. [OOP] Redo the same program above using this->

  104. [OOP] Temperature converter. Write a class called TemperatureConverter with methods to convert between Celsius and Fahrenheit. From Celsius Kelvin. to Create an object of this class, and use it to convert a temperature from one scale to another.

  105. [OOP] Simple calculator. Create a class called Calculator that can perform basic arithmetic operations (addition, subtraction, multiplication, division). Create an object of the class and use it to perform some calculations.

  106. [OOP] Create a class Rectangle with attributes for its length and width. Implement a method to calculate the area of the rectangle. Create an object and compute the area for a specific rectangle.

  107. [OOP] Simple To-Do List: Design a basic to-do list application where users can add, remove, and display tasks. You can save tasks in an array.

  108. [OOP] Define a class student with the following specifications.

    Student
    ---
    + Student_ID: String
    + Student_Name: String
    + OOP2_Score: double
    + Maths_Score: double
    + English_Score: double
    + Total_Score: double
    ---
    + ctotal(): Function to calculate eng + math + OOP-2 with double return type.
    + Takedata(): Function to accept values for student ID, Student Name, eng, OOP-2, maths and invoke ctotal() to calculate total.
    + Showdata(): Function to display all the data members on the screen.
  109. [OOP] The class Person with private attributes name(string) and age(int).

    The class contains three functions.

    • One with no parameter (for initializing default value).

    • With two parameters (one parameter with default value).

    • Function to display the data.

      Person
      ---
      + Name: String
      + Age: int
      ---
      + Display()
      <constructor> + Person()
      <constructor> + Person(a: int)
  110. [OOP] Inheritance: https://github.com/Rustam-Z/cpp-programming/tree/main/OOP2_Lab6

  111. [OOP] Encapsulation: https://github.com/Rustam-Z/cpp-programming/tree/main/OOP2_Lab7

    Write a C++ menu-driven program to get employee details, display employee details, and display monthly salary details of employees.****

    Employee
    ---
    - Employee_ID: String
    - Employee_Name: String
    - No_of_Hours_Work: int
    - Rate_per_Hour: int
    ---
    + setEmployee_ID(String)
    + getEmployee_ID(): String
    + setEmployee_Name(String)
    + getEmployee_Name(): String
    + setNo_of_Hours_Work(int)
    + getNo_of_Hours_Work(): int
    + setRate_per_Hour(int)
    + getRate_per_Hour(): int 
    + getTotal_Monthly_Salary(): double
  112. [OOP] Polymorphism: https://github.com/Rustam-Z/cpp-programming/tree/main/OOP2_Lab8

More questions can be found in the LAB folders above.

Projects Ideas

  1. Banking system with all banking facilities like – deposit, withdrawal, foreign exchange to any currency, availability of loans for purchasing vehicles, apartments, houses, setting up business, education loan, management of ATMs, and all other features.
  2. Airline flight reservation system (online booking of tickets on different flights for different destinations all over the world, cancellation of tickets, clear display of cancellation amount, refund of the amount after cancellation, showing availability of all flights, showing flights timings for all 7 days of a week, seats availability, seat selection for travelers by giving the complete layout of the seating arrangement inside the flights, food availability/non-availability inside the flights, change of travel dates and the amount charged.)
  3. Taxi/cab sharing app
  4. University education portal (providing all information about undergraduate, postgraduate, and doctoral programs offered, facilities available, location & map, and fee structure in all the universities)
  5. Online exam management system (with total security of identifying the students during exam, monitoring the student's activities during the exam, selection of different questions for each student, development of a large question bank containing hundreds of questions in each subject considering all courses taught at the university)
  6. Library management system
  7. E-content management system
  8. Plagiarism checker & file management system
  9. Hotel reservation & management portal
  10. Restaurant management
  11. Healthcare consulting system (doctors with different specializations for consultation, hospitals with all facilities for treating different diseases & abroad - one-stop portal for all consultations and treatments)
  12. Electronic health record management system with built-in security
  13. Pharmacy - medical store management
  14. Blood bank system
  15. Online shopping and delivery system (like Amazon)
  16. Online car shopping
  17. Tourism portal
  18. World tourism portal
  19. Higher education abroad portal
  20. Job search/recruitment portal
  21. Company resource management system
  22. Attendance monitoring system with fingerprints verification
  23. Face recognition - based attendance checking system
  24. Aircraft communication and monitoring system
  25. Ticket booking management system for concert ceremonies
  26. All store stock management (inventory control)
  27. Multiplayer gaming applications
  28. City traffic monitoring and control system
  29. Police traffic violation reporting & control system
  30. The marriage function hall booking & food/music arrangement system
  31. Any vehicle (car, bus, heavy vehicles for parties, functions, family picnics, long-distance travel) booking portal
  32. Teacher-assisted program writing environment for students
  33. Doctors reservation system for patients
  34. Bus reservation & tracking system
  35. Railway booking and train tracking system
  36. Warehouse management system
  37. Courier tracking, cargo, and freight transportation
  38. Online code testing system
  39. Online quiz system (with total security of identifying the students during the quiz, monitoring the students’ activities during the quiz, selection of different quiz questions for each student, development of a large quiz question bank containing hundreds of quiz questions in each subject considering all courses taught at the university)
  40. Land/house/apartment rental & purchase portal
  41. Housecleaning, plumbing, electricity service & maintenance system
  42. Human organ transplantation management system
  43. Covid-19 tracking, testing, treatment & hospital management system
  44. Cryptocurrency trading portal (exchange) allowing trading of all crypto coins using security, confidentiality, and authentication
  45. Parking management system
  46. Online food delivery system (linked to all restaurants in different districts in different regions in some countries)
  47. *Food ordering system | Get order → print cheque as PDF file → see order status on separate HTML page.
  48. *Weather app that recommends what to wear as a telegram bot.
  49. *QR code generator, as a CLI tool, as a telegram bot.
  50. *Remainder application (crontab tool) as a telegram bot, as a CLI application.
  51. *Build own URL shortener as a telegram bot, as a CLI application, web app.
  52. Math library with functions as a library.
  53. Lost and found as a web app.

More Project Ideas

About

🦕 C++ Programming & Introduction to Computer Science. You can find Lab Assignments and solutions, interesting C++ programs, and lots of different resources to start learning coding with C++.

Topics

Resources

Stars

Watchers

Forks