Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <string>
- #include <algorithm>
- using namespace std;
- bool within_limits(char c)
- {
- if(c >= '1' && c <= '4')
- return true;
- return false;
- }
- int main()
- {
- string s;
- ofstream outfile;
- outfile.open("generate.txt");
- for(unsigned long long int i = 11111111; i <= 44444444; ++i)
- {
- s = to_string(i);
- if(!any_of(s.begin(), s.end(), [](char q){return !within_limits(q);
- }))
- {
- outfile << "a ";
- for(unsigned short int j = 0; j < 4; ++j)
- {
- outfile << s[j] << ' ';
- }
- outfile << "b ";
- for(unsigned short int j = 4; j < 8; ++j)
- {
- outfile << s[j] << ' ';
- }
- outfile << '\n';
- }
- }
- outfile.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement