initial checkin from subversion
This commit is contained in:
40
permutat1-dokumentiert.cc
Normal file
40
permutat1-dokumentiert.cc
Normal file
@@ -0,0 +1,40 @@
|
||||
//Program Permutation
|
||||
//Backtacking (Variable anzahl von ineinander geschachtelten Schleifen
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream.h>
|
||||
|
||||
int n=20; // Anzahl Schleifen
|
||||
|
||||
char Feld[100];
|
||||
char anfang,ende;
|
||||
|
||||
void ForS(int Ebene)
|
||||
{
|
||||
char i;
|
||||
int k;
|
||||
|
||||
if (Ebene <= n-1){
|
||||
for(i=anfang;i <= ende; i++) {
|
||||
Feld[Ebene] = i;
|
||||
ForS(Ebene+1);
|
||||
}
|
||||
} else {
|
||||
for(k=0;k<=n-1;k++){
|
||||
cout << Feld[k] ;
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
cout << "Wieviele Schleifen sollen geschachtelt werden (max.100):";
|
||||
cin >> n;
|
||||
cout << "Anfangen bei:";
|
||||
cin >> anfang;
|
||||
cout << "Ende bei:";
|
||||
cin >> ende;
|
||||
cout << endl;
|
||||
ForS(0);
|
||||
}
|
||||
Reference in New Issue
Block a user