+ 3

No Output

I want to create a infinite loop which calls main function code again and again https://code.sololearn.com/cpQjOI3LK1o8/?ref=app

20th Sep 2018, 5:12 AM
C ++
C ++ - avatar
2 Respuestas
+ 5
Hi! You have a mistake in the while: z = 0. This case is using: while (z == 0) . Your code: #include <iostream> using namespace std; class Square { int size; public: void set_size(int s); int get_size(); int area() { return size * size; } }; void Square::set_size(int s) { size = s; } int Square::get_size() { return size; } int main() { int z = 0; while (z == 0){//here Square x; int a; cout << "Please! Enter side length :"; cin >> a; x.set_size(a); cout << "Area of square with side length " << x.get_size() << " is " << x.area() << endl; } return 0; }
20th Sep 2018, 6:16 AM
Nimrod A. Holguín L.
Nimrod A. Holguín L. - avatar
+ 3
my mind is boiling badly very little mistake and I'm not understanding....
20th Sep 2018, 11:55 AM
C ++
C ++ - avatar