Solution for Member Initializers In c++

Member Initializers You are making a program to store TVs with their width and height. The given program declares a TV class with height and width members, an area() method, as well as a constructor that initializes the members of the class. Complete the program by taking 2 integers as input, create a TV object by passing them to the constructor, and call the area() method. Note, that the constructor needs 2 integer values. solve: ------- // TITLE: test.cpp #include<bits/stdc++.h> #include <iostream> using namespace std; typedef long long ll; typedef long double ld; void solve(){ std::vector<char> v; } class A { int l,b,area; public: void rectangle(){ cin>>l>>b; cout<<l*b; } }; int main() { ios::sync_with_stdio(0); A obj; obj.rectangle(); return 0; }

7th May 2021, 8:24 PM
1 Answer
+ 6
Read and follow the instruction carefully. Failing to do so will fail you if this was a challenge, or assignment. Continue your study with C++ and you'll get to these chapters, which are related to the task. https://www.sololearn.com/learn/CPlusPlus/1896/ https://www.sololearn.com/learn/CPlusPlus/1715/
7th May 2021, 9:37 PM