not use for, print 1-100;

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <string>
const std::string STR = "100110110010100110";
class foo {
static int position;
static int count;
static std::string str;
public:
foo();
static std::string getResult();
};
foo::foo() {
if (str[count] == '1') {
position = count;
}
count++;
}
std::string foo::getResult() {
str[position] = '0';
return str;
}
int foo::position = 0;
int foo::count = 0;
std::string foo::str = STR;
int main() {
foo exp[STR.length()];
std::cout<<foo::getResult()<<std::endl;
return 0;
}