Untitled
unknown
plain_text
2 years ago
549 B
10
Indexable
#include <iostream>
using namespace std;
class sample {
public:
static int x;
static int y;
int greater(int a, int b) {
x = a;
y = b;
if (x > y) {
return a;
}
return y;
}
};
int sample::x;
int sample::y;
int main() {
sample s1, s2, s3;
cout << "greater is " << s1.greater(1, 2) << endl;
cout << "greater is " << s1.greater(1, 2) << endl;
cout << "greater is " << s2.greater(5, 2) << endl;
cout << "greater is " << s2.greater(5, 2) << endl;
return 0;
}
Editor is loading...