#include <iostream>
class FOR {
private:
int loop;
int range;
int G;
public:
FOR(int r[3]) {
this->loop = r[1];
this->range = r[0];
this->G = r[2];
}
bool Loop() {
this->loop+=this->G;
return (this->loop <= this->range);
}
int get() {
return this->loop;
}
};
int main() {
int x[] = {10,0,1};
FOR obj(x);
while (obj.Loop()) {
std::cout << obj.get();
if (obj.get() % 2 == 0) {
std::cout << "は偶数" << std::endl;
}else{
std::cout << "は奇数" << std::endl;
}
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: