+ 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
2 Answers
+ 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;
}
+ 3
my mind is boiling badly very little mistake and I'm not understanding....