just trying to get used to classes.
Whenever i run the program, it works fine, except for a random number that pops up.
source:
output:
any ideas?
Whenever i run the program, it works fine, except for a random number that pops up.
source:
Code:
#include <iostream>
using namespace std;
class CRectangle
{
public:
int x, y;
int area()
{
int a = x*y;
cout << a << "\n";
}
};
int main()
{
CRectangle area;
cout << "What is the length: ";
cin >> area.x;
cout << "What is the width: ";
cin >> area.y;
cout << area.area() << "\n";
return 0;
}
Code:
What is the length: 9 What is the width: 97256 875304 134521056
Comment