Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<fstream>
- #include <iostream>
- #include<math.h>
- #include<cstring>
- using namespace std;
- ifstream fin("produscartezian1.in");
- ofstream fout("produscartezian1.out");
- int st[10],n,m;
- void afisare_stiva()
- {
- int i;
- for(i=1; i<=m; i++) fout<<st[i]<<" ";
- fout<<endl;
- }
- void back(int nivel)
- {
- if(nivel>m) afisare_stiva();
- else
- {
- for(int i=1; i<=n; i++)
- {
- st[nivel]=i;
- back(nivel+1);
- }
- }
- }
- int main ()
- {
- fin>>n>>m;
- back(1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement