<br />
<b>Warning</b>:  Undefined array key "HTTP_REFERER" in <b>/var/www/vhosts/web61970.ssd-space.de/phi.pf-control.de/uni/download.php</b> on line <b>13</b><br />
#include <iostream>

using namespace std;

int main()
{
    unsigned int z[5], l[5], r=0,w=0;
    cout<<"Lottozahlen 6 aus 49!\nIhr Tipp: \n";
    for(int i=0;i<6;i++){
      cout<<"Zahl "<<(i+1)<<": ";
      cin>>z[i];
      if(z[i]<1||z[i]>49){
        cout<<"Bitte waehlen Sie aus 1 bis 49!\n";
        i--;                    
      }
      for(int j=0;j<i;j++){
         if(z[i]==z[j]){
           cout<<"Bereits benutzt!\n";
           i--;
           j=i;
         }
      }
    }
    srand ( time(NULL) );
    cout<<"\nLottozahlen: ";
    for(int i=0;i<6;i++){
      l[i]=(rand()%49)+1;  
      for(int j=0;j<i;j++){
         if(l[i]==l[j]){
           i--;
           j=i;
         }
      }
    }
    for(int i=5; i>0; i--){
      for (int j=0; j<i; j++){
        if (l[j]>l[j+1]){
          w = l[j];
          l[j] = l[j+1];
          l[j+1] = w;
        }
      }
    }
    for(int i=0; i<6; i++){
      cout<<l[i]<<" ";
    }
    cout<<"\nTreffer: ";
    for(int j=0;j<6;j++){
      for(int i=0;i<6;i++){
        if(l[i]==z[j]){cout<<z[j]<<" ";r++;i=6;}
      }
    }
    
    if(r==0){cout<<"keine";}else{cout<<endl<<r<<" Treffer!";}
    cout<<endl<<endl<<"Auf Wiedersehen!"<<endl;
    system("PAUSE");
    return EXIT_SUCCESS;
}
 
