+ 1
Help!
I am stuck on c++ challenge 49.2 please help me #include <iostream> using namespace std; class TV { public: TV(int h, int w): height(h), width(w) {}; void area() { cout <<height*width; } private: int height; int width; }; int main() { //your code goes here int h; int w; cin>>h; cin>>w; TV obj (h,w); }
12 Respostas
+ 3
You need to call the area function to print out the value
obj.area();
+ 3
Rik Wittkopp
No no, it's ok , no need to do that,I'm just happy to help
Thanks for mentioning međ€
+ 1
Boong Bing
Challenge 49.2 in c++ is called "Chirp Chirp".
Can you please confirm the lesson / challenge number?
+ 1
Boong Bing
I suspect Myo Thuzar gave you a better answer
+ 1
Boong Bing
Yep, confirmed!
Myo Thuzar has given you an exact answer
int main() {
//your code goes here
int h;
int w;
cin>>h;
cin>>w;
TV obj(h,w);
obj.area();
}
+ 1
Boong Bing
Give best answer to Myo Thuzar
He solved it!
+ 1
Thank You Myo Thuzar
0
60.2
0
Please specify the relevant language (C++) in the tags â
https://code.sololearn.com/W3uiji9X28C1/?ref=app
0
Boong Bing
Can you confirm that you haven't altered the code above the section which says
// Your code goes here
0
I am not sure of what you have done prior to posting, or what the original code looked like, but maybe this can help you
#include <iostream>
using namespace std;
class TV {
public:
TV(int h, int w);
private:
int height;
int width;
};
TV::TV(int h, int w): height(h),width(w){
cout << height * width;
}
int main() {
//your code goes here
int h,w;
cin >> h >> w;
TV(h,w);
}
0
Thanks I appreciate all your help!