Moderator: Moderatorzy

const int nE = 49; // liczba elementów
const int nP = 6; // liczba pozycji
int l[nP]; // tablica z liczbami
void wyswietl()
{
for( int i = 0; i < nP; ++i )
cout << l[i] << " : ";
cout << endl;
}
void zapelnij( int pos )
{
if( pos == nP-1 )
for( int x = 0 ; x < nE ; ++x )
{ l[pos] = x+1; wyswietl(); }
else
for( int x = 0 ; x < nE ; ++x )
{ l[pos] = x+1; zapelnij( pos+1 ); }
}

#include <iostream>
int main()
{
int n1, n2, n3, n4, n5, n6;
n1=0;
n2=0;
n3=0;
n4=0;
n5=0;
n6=0;
for(n1=1; n1<=49; n1++)
for(n2=n1+1; n2<=49; n2++)
for (n3=n2+1; n3<=49; n3++)
for (n4=n3+1; n4<=49; n4++)
for (n5=n4+1; n5<=49;n5++)
for (n6=n5+1; n6<=49; n6++)
std::cout<<n1<<' '<<n2<<' '<<n3<<' '<<n4<<' '<<n5<<' '<<n6<<'\n';
return 0;
}

Użytkownicy przeglądający to forum: Brak zalogowanych użytkowników i 0 gości