0

fill the line 1

#include <iostream> using namespace std; class Container { int arr[5]; int i; public: Container() : i(-1) { } ____________________ { // LINE-1 this->arr[++i] = val; return *this; } operator int() { return arr[i--]; } }; int main() { Container c; int k; for (int i = 0; i < 5; i++) { cin >> k; c = k; } for (int i = 0; i < 5; i++) cout << (int)c << " "; return 0; }

16th Mar 2020, 10:52 AM
Lazy_codeR.04
Lazy_codeR.04 - avatar
7 Answers
+ 3
Kahkeshan Begum Is that one of the quizzes, or you see it in lesson, or where?
17th Mar 2020, 11:48 AM
Ipang
+ 2
Okay I get it 👌
17th Mar 2020, 2:10 PM
Ipang
16th Mar 2020, 10:54 AM
Fernando Pozzetti
Fernando Pozzetti - avatar
+ 1
Container operator =(int &val) --- is the answer
17th Mar 2020, 11:39 AM
Lazy_codeR.04
Lazy_codeR.04 - avatar
+ 1
@ipang i m gng through a ol course where i shld do this kind of assignment
17th Mar 2020, 2:09 PM
Lazy_codeR.04
Lazy_codeR.04 - avatar
0
I had gone through tht before posting the question . The problem is operator overloading shld b done with variable declaration of " Val ", which I am unable to do ..... Thanks for the try
17th Mar 2020, 3:33 AM
Lazy_codeR.04
Lazy_codeR.04 - avatar
0
help
26th Aug 2020, 11:42 AM
Shahid Hussain Lashari
Shahid Hussain Lashari - avatar