Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <vector>
- #include <string>
- using namespace std;
- string CharsToString(char a, char b, char c, char d);
- int main(int argc, char** argv) {
- setlocale(LC_ALL,"");
- char abcd[4] = {'a','b','c','d'};
- vector<char> cv;
- vector<string> csv;
- int sum = 0;
- for(char a='a'; a<='d'; ++a) {
- for(char b='a'; b<='d'; ++b) {
- for(char c='a'; c<='d'; ++c) {
- for(char d='a'; d<='d'; ++d) {
- sum++;
- string newS = CharsToString(a,b,c,d);
- csv.push_back(newS);
- cout << newS << endl;
- }
- }
- }
- }
- if ( find(csv.begin(), csv.end(), "cccc") != csv.end() )
- cout << "Létezik! " << sum << endl;
- else
- cout << "Nem létezik!" << endl;
- return 0;
- }
- string CharsToString(char a, char b, char c, char d){
- string aS;
- aS.push_back(a);
- string bS;
- bS.push_back(b);
- string cS;
- cS.push_back(c);
- string dS;
- dS.push_back(d);
- return aS+bS+cS+dS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement