Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void oblicz(int n, char a, char b, char c)
- {
- if(n>0)
- {
- oblicz(n-1,a,c,b);
- cout<<a<<" na "<<b<<endl;
- oblicz(n-1,c,b,a);
- }
- }
- int main()
- {
- int m;
- cout << "Podaj wartosc danej n " << endl;
- cin>>m;
- char x='A',y='B',z='C';
- if(m==0)
- {
- cout<<"KONIEC"<<endl<<endl;
- }
- else
- {
- oblicz(m,x,y,z);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement