Я написал эту программу, но она не работает. Он дает ошибку, что x
и y
не были объявлены и ожидаются первичное выражение перед int on line 17
.классы C++ не работают для меня
#include<iostream>
using namespace std;
class shapes
{
int width, height;
public:
int getvalue();
void decideshape(int l, int b);
};
main()
{
cout<<"to find what type of shape you have input the measurements"<<endl;
shapes toy;
toy.getvalue();
toy.decideshape();
}
int shapes::getvalue()
{
int l, b;
cout<<"length = ";
cin>>l;
cout<<"breath = ";
cin>>b;
}
void shapes::decideshape(x, y)
{
if(x==y)
cout<<"This is square"<<endl;
else
cout<<"This is rectangle"<<endl;
}
, как я должен вернуть 2 значения из функции GetValue
Также можно определить тип возвращаемого значения для 'GetValue()', так что вы должны возвращать целое число, даже если это is 'return 0;' –