title-img


Print Pretty C++

Given a text file with many lines of numbers to format and print, for each row of 3 space-separated doubles, format and print the numbers using the specifications in the Output Format section below. Input Format The first line contains an integer, T , the number of test cases. Each of the T subsequent lines describes a test case as 3 space-separated floating-point numbers: A , B and C, respectively. Constraints 1 <= T <= 1000 Each number will fit into a double. Output Format

View Solution →

Deque-STL C++

Double ended queue or Deque(part of C++ STL) are sequence containers with dynamic sizes that can be expanded or contracted on both ends (either its front or its back). The member functions of deque that are mainly used are: Deque Template: std::deque<value_type> Declaration: deque<int> mydeque; //Creates a double ended queue of deque of int type Size int length = mydeque.size(); //Gives the size of the deque Push mydeque.push_back(1); //Pus

View Solution →

Inheritance Introduction c++

One of the important topics of Object Oriented Programming is Inheritance. Inheritance allows us to define a class in terms of another class, which allows us in the reusability of the code.Check out the code below: class Triangle{ public: void triangle(){ cout<<"I am a triangle\n"; } }; The class Triangle has a function called triangle(). Now we create a class derived from the base class Triangle called Isosceles. class Isosceles : public Triangle{

View Solution →

Rectangle Area C++

In this challenge, you are required to compute the area of a rectangle using classes. Create two classes: Rectangle The Rectangle class should have two data fields-width and height of int types. The class should have display() method, to print the width and height of the rectangle separated by space. RectangleArea The RectangleArea class is derived from Rectangle class, i.e., it is the sub-class of Rectangle class. The class should have read_input() method, to read the values of w

View Solution →

Multi Level Inheritance C++

This challenge is an extension of a previous challenge named Inheritance-Introduction. We highly recommend solving Inheritance-Introduction before solving this problem. In the previous problem, we learned about inheritance and how can a derived class object use the member functions of the base class. In this challenge, we explore multi-level inheritance. Suppose, we have a class A which is the base class and we have a class B which is derived from class A and we have a class C which is der

View Solution →