Posts

Recent Post

Day 0: Hello, World.cpp-HackerRank

Image
Problem-   In this challenge, we review some basic concepts that will get you started with this series. You will need to use the same (or similar) syntax to read input and write output in challenges throughout HackerRank.  Solution- #include   < cmath > #include   < cstdio > #include   < vector > #include   < iostream > #include   < algorithm > using   namespace  std; int  main() {     string str;      getline(cin,str);           cout <<  "Hello, World."  << endl;     cout << str <<endl;      return   0 ; } Link to the problem- https://www.hackerrank.com/challenges/30-hello-world/problem

Rectangle Area.cpp-HackerRank

Problem- 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   width   and   height   of the rectangle. The   RectangleArea   class should also overload the   display()   method to print the area     of the rectangle. Solution- #include   < iostream > using   namespace  std; class  Rectangle {      protected :          int  width;      ...