Advertisement
Farjana_akter

Untitled

Jun 29th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. void combination(int pos,char letter)
  4. {
  5. if(pos==3)
  6. {
  7.  
  8. return;
  9. }
  10. if(pos==0)
  11. {
  12. combination(pos+1,'a');
  13. combination(pos+1,'b');
  14. combination(pos+1,'c');
  15. }
  16. else
  17. {
  18. if(letter=='a')
  19. {
  20. combination(pos+1,'b');
  21. combination(pos+1,'c');
  22. }
  23. else if(letter=='b')
  24. {
  25. combination(pos+1,'a');
  26. combination(pos+1,'c');
  27. }
  28. else
  29. {
  30. combination(pos+1,'a');
  31. combination(pos+1,'b');
  32. }
  33.  
  34. }
  35. }
  36. int main()
  37. {
  38. combination(1,'a');
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement