/tasks.cpp

A collection of C++ programs that covers code of various popular problems.

Primary LanguageC++MIT LicenseMIT

lab logo  

tasks.cpp

Status GitHub Issues GitHub Pull Requests License


A collection of C++ programs that covers code of various popular problems.

Contributing to this repo will count against one of the PRs for HacktoberFest2020 only if submitted between 1st October and 31st October.

Please refer to CONTRIBUTING.md for the same.

The following problems need solutions as on date 4th Oct, 2020

  1. WAP to find area of a circle, a rectangle and a triangle, using concept of function overloading.
  2. WAP to find volume of a sphere, a cylinder and a cuboid, using function overloading.
  3. WAP which displays a given character, n number of times, using a function. When the n value is not provided, it should print the given character 80 times. When both the character and n value is not provided, it should print ‘*’ character 80 times. Write the above program in two ways:-
    • using function overloading.
    • using default arguments
  4. WAP to find square and cube of a number using inline function.
  5. WAP to increment the value of an argument given to function USINGINLINE function.
  6. Write a program to create a class called COMPLEX and implement the following overloading functions ADD that return a COMPLEX number.
    • ADD (a , s2) - where a is an integer (real part) and s2 is a complex number.
    • ADD (s1, s2) - where s1 and s2 are complex numbers.
  7. Write a program to demonstrate the concept of call-by-value, call-by-reference & call-by address by taking swapping of two numbers as an example.
  8. Write a program to demonstrate the use of scope resolution operator(::) by declaring same variable name globally and locally and display the value of global and local variables.
  9. Create a class ‘shape’. Derive three classes from it: Circle, Triangle and Rectangle. Include the relevant data members and functions in all the classes. Find the area of each shape and display it.
  10. Create a class which stores employee name,id and salary Derive two classes from ‘Employee’ class: ‘Regular’ and ‘Part-Time’. The ‘Regular’ class stores DA, HRA and basic salary. The ‘Part-Time’ class stores the number of hours and pay.
  11. .Write a program to find out the greatest between two numbers defined in two different classes by using friend function

🏁 Getting Started

Clone the repo and run in the directory

g++ main.cpp -o main.out && ./main.out

🎈 Usage

  • The interface of the menu is fairly simple, you just have to enter the number, which is against the function you wish to run and then follow the instructions displayed.

❗ Issues

If you find any bugs, please create an issue. We will work towards resolving it as fast as we can.

✍️ Authors

See also the list of contributors who participated in this project.