Advertisement
xSpydy

dapdporst

Oct 21st, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ifstream fin("produscartezian1.in");
  5. ofstream fout("produscartezian1.out");
  6.  
  7. int n, m, x[10];
  8.  
  9.  
  10. void tipar(int k){
  11. for(int i=1 ; i <= k ; ++i)
  12. fout << x[i] << " ";
  13. fout << endl;
  14. }
  15.  
  16. void back(int k){
  17. for(int i = 1; i <= n ; ++i)
  18. {
  19. x[k]=i;
  20. if(k == m)
  21. tipar(k);
  22. else
  23. back(k+1);
  24. }
  25. }
  26.  
  27. int main(){
  28. fin >> n >> m;
  29. back(1);
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement