Skip to content

In this repository, you will find solutions to all the basic concepts of c++, solutions to concepts of array, vector, string, and some simple project using the oop concept.

Notifications You must be signed in to change notification settings

devhimal/oop-concepts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++ Assignment

This repository contains solutions to various C++ programming problems. The assignment covers multiple concepts including basics, loops, patterns, strings, arrays, vectors, recursion, and object-oriented programming (OOP).

Instructions

  • Individual Assignment: Each student is required to complete this assignment individually.
  • Repository: Create a new GitHub repository named CPP Assignment and upload your code solutions.
  • Git Workflow: Follow proper Git and GitHub workflows:
    • Create branches for each problem.
    • Do not push code directly to the main branch.
    • Create a pull request for merging.
  • Understanding: Ensure you understand the concepts before solving each question, as you may be asked to explain your solution.
  • Deadline: Submit your assignment by 2024-09-20.

Assignment Problems

Basics

  1. Reverse Name:

    • Write a C++ program that accepts the user's first and last name and prints them in reverse order with a space between them. Getting Started
  2. Swap Variables:

    • Write a C++ program that swaps two variables without using a third variable. Getting Started
  3. Swap First and Last Digits:

    • Write a C++ program to swap the first and last digits of any number. Getting Started
  4. Sum of Digits Between Integers:

    • Write a C++ program to add up all the digits between two given integers. Getting Started
  5. Top Three Numbers:

    • Write a C++ program that prints the three highest numbers from a list in descending order. Getting Started
  6. Sum and Digit Count:

    • Write a C++ program to compute the sum of two given integers and count the number of digits in the sum value. Getting Started
  7. Factorial Calculation:

    • Write a C++ program that reads an integer and prints its factorial.
  8. Days in a Month:

    • Write a C++ program to compute the number of days in a month for a given year and month.
  9. Days Between Dates:

    • Write a C++ program to count the number of days between two given dates.
  10. Repeated Digit Sum:

    • Write a C++ program to repeatedly add all digits of a given non-negative number until the result is a single digit.
  11. Power of Three:

    • Write a C++ program to check if a given integer is a power of three or not.
  12. Square Root Calculation:

    • Write a C++ program to compute the integer square root of a given non-negative integer.
  13. Count Prime Numbers:

    • Write a C++ program to count prime numbers less than a given positive number.
  14. Product of Digits:

    • Write a C++ program to calculate the product of the digits of any number.
  15. Factors of a Number:

    • Write a C++ program to find all factors of a given number.
  16. One's Complement:

    • Write a C++ program to find the one's complement of a binary number.
  17. Two's Complement:

    • Write a C++ program to find the two's complement of a binary number.
  18. Decimal to Binary:

    • Write a C++ program to convert a decimal number to a binary number.
  19. Binary to Decimal:

    • Write a C++ program to convert a binary number to a decimal number.
  20. Decimal to Hexadecimal:

    • Write a C++ program to convert a decimal number to a hexadecimal number.

Loops

  1. Perfect Numbers:

    • Write a program to find perfect numbers between 1 and 500.
  2. Last Prime Before Number:

    • Write a program to find the last prime number before a given number.
  3. Sum of Series:

    • Write a program to find the sum of the series 1 + 11 + 111 + ... up to n terms.
  4. Fibonacci Series:

    • Write a program to display the first n terms of the Fibonacci series.
  5. Non-Prime Numbers:

    • Write a program to list non-prime numbers between 1 and an upper bound.
  6. Cube of Numbers:

    • Write a program to display the cube of numbers up to a given integer.
  7. Numbers Divisible by 9:

    • Write a program to find numbers between 100 and 200 divisible by 9 and their sum.
  8. Reverse Order:

    • Write a program to display numbers in reverse order.
  9. Sum of A.P. Series:

    • Write a program to find the sum of an Arithmetic Progression (A.P.) series.

Patterns

  1. Right-Angle Triangle (Asterisk):

    • Write a program to display a right-angle triangle pattern using an asterisk.
  2. Right-Angle Triangle (Numbers):

    • Write a program to display a right-angle triangle pattern using numbers.
  3. Incremental Triangle:

    • Write a program to display a right-angle triangle pattern with numbers increasing by 1.
  4. Pyramid (Asterisk):

    • Write a program to display a pyramid pattern using an asterisk.
  5. Pyramid (Repeating Numbers):

    • Write a program to display a pyramid pattern with repeating numbers.
  6. Floyd's Triangle:

    • Write a program to display Floyd's Triangle.
  7. Pascal's Triangle:

    • Write a program to display Pascal's Triangle.
  8. Reverse Triangle:

    • Write a program to display a pattern with decreasing columns.
  9. Right-Justified Digits:

    • Write a program to display a right-justified digit triangle.
  10. Alphabet Pyramid:

    • Write a program to display a pyramid pattern using the alphabet.
  11. Odd Number Triangle:

    • Write a program to display an odd-numbered triangle pattern.

String Concepts

  1. Reverse String:

    • Write a C++ program to reverse a given string.
  2. Capitalize Words:

    • Write a C++ program to capitalize the first letter of each word in a string.
  3. Largest Word:

    • Write a C++ program to find the largest word in a string.
  4. Palindrome Check:

    • Write a C++ program to check if a given string is a palindrome.
  5. Word with Most Repeated Letters:

    • Write a C++ program to find the word with the highest number of repeated letters.
  6. Integer to English Words:

    • Write a C++ program to convert a non-negative integer into English words.
  7. Remove Specific Character:

    • Write a C++ program to remove a specific character from a string.

Array Concepts

  1. Largest Three Elements:

    • Write a C++ program to find the largest three elements in an array.
  2. Second Largest Element:

    • Write a C++ program to find the second largest element in an array.
  3. K Largest Elements:

    • Write a C++ program to find the k largest elements in an array.
  4. Smallest Missing Element:

    • Write a C++ program to find the smallest element missing from a sorted array.
  5. Update Array Elements:

    • Write a C++ program to update every array element by multiplying the next and previous values.
  6. Two Repeating Elements:

    • Write a C++ program to find the two repeating elements in an array.
  7. First Repeating Element:

    • Write a C++ program to find the first repeating element in an array.
  8. Second Lowest and Highest Elements:

    • Write a C++ program to find the second lowest and highest elements in an array.
  9. Third Largest String:

    • Write a C++ program to find the third largest string in an array.
  10. Count Occurrences:

    • Write a C++ program to count the number of occurrences of a given number in a sorted array.

Vector Concepts

  1. Smaller Than Neighbors:

    • Write a C++ program to return the elements in a vector that are strictly smaller than their adjacent neighbors.
  2. Capitalize First Character:

    • Write a C++ program to capitalize the first character of each element in a string vector.
  3. Strings with Numbers:

    • Write a C++ program that returns strings containing numbers from a vector of strings.
  4. String Containment Check:

    • Write a C++ program to verify if all letters of the second string appear in the first string.
  5. Matrix Creation:

    • Write a C++ program to create an n x n matrix based on user input.

Recursion Concepts

  1. Sum of Array Elements:

    • Write a C++ program to find the sum of all elements in an array using recursion.
  2. Factorial Using Recursion:

    • Write a C++ program to calculate the factorial of a given number using recursion.
  3. Nth Fibonacci Number:

    • Write a C++ program to implement a recursive function to get the nth Fibonacci number.
  4. Reverse String Recursively:

    • Write a C++ program to reverse a string using recursion.
  5. Palindrome Check Recursively:

    • Write a C++ program to implement a recursive function to check if a string is a palindrome.
  6. Sum of Even and Odd Numbers:

    • Write a C++ program to implement a recursive function to calculate the sum of even and

OOP concepts

  1. Write a C++ program to implement a class called Employee that has private member variables for name, employee ID, and salary. Include member functions to calculate and set salary based on employee performance.
  2. Write a C++ program to implement a class called Date that has private member variables for day, month, and year. Include member functions to set and get these variables, as well as to validate if the date is valid.
  3. Write a C++ program to implement a class called Student that has private member variables for name, class, roll number, and marks. Include member functions to calculate the grade based on the marks and display the student's information.
  4. Write a C++ program to create a class called Triangle that has private member variables for the lengths of its three sides. Implement member functions to determine if the triangle is equilateral, isosceles, or scalene.

About

In this repository, you will find solutions to all the basic concepts of c++, solutions to concepts of array, vector, string, and some simple project using the oop concept.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages