Permutations

What's up! So it is my first time taking C++ and I have no experience with programming and I'm doing some class work involving permutations. I've been struggling a lot and currently having a hard time remembering statements etc. So I need to write a program of a permutation of A, B, and C. Thanks!
Please state your problem in terms of C++--which classes/functions do you need?
What are "permutations of A, B, and C"?
Nvm I figured it out! Thanks though!
OK. I'd be curious to know what you were trying to do though :)
closed account (LA48b7Xj)
OK. I'd be curious to know what you were trying to do though :)


I think he was trying to print all the different combinations of A B C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

int main ()
{
    string s {"ABC"};
    cout << s << '\n';

    while(next_permutation(s.begin(), s.end()))
        cout << s << '\n';
}
Last edited on
Yeah, I thought it was something like that :)
Topic archived. No new replies allowed.