avenger2099
Mitglied
M. Visual C++ V 6
Windows 2k
Konsolenanwendung
OOP
____________________________________________________________________
Hy ich soll für die Schule ein Lotto Programm in OOP schreiben, wo man 6 Zahlen eingibt, und die mit 6 generierten vergleivht werden, ich habe im moment probleme beim vergleichen
Windows 2k
Konsolenanwendung
OOP
____________________________________________________________________
Code:
// 10 Zahlen in einem array sortieren
#include<iostream>
#include <algorithm>
#include <ctime>
#include <conio.h>
#include<cstdlib>
#include<string>
#include<windows.h>
#include<string>
#include <fstream> // zum schreien in datein
#include <stdio.h> // zum erstellen von datein
using namespace std;
int i,k;
class lotto
{
private:
int lottozahlen[6];
public:
lotto();
unsigned int lotto_zahlen_eingeben();
void lotto_zahlen_ausgeben();
void lotto_zahlen_vergleichen();
};
lotto::lotto()
{
lottozahlen[i]=0;
}
unsigned int lotto::lotto_zahlen_eingeben()
{
int i=0;
do
{
cout<<"Bitte geben sie die "<<i+1<<". lotto_zahl ein:\t";cin>>lottozahlen[i];
i++;
}while(i<6);
return lottozahlen[i];
}
void lotto::lotto_zahlen_ausgeben()
{
for(i=0;i<6;i++)
{
do
{
srand( (unsigned)time( NULL ) );
lottozahlen[i] = rand() %49+1;
}while(lottozahlen[i] != lottozahlen[i]);
}
cout << lottozahlen[i] << endl;
}
/*void sortierer::zahlen_auslesen()
{
for(int k=0;k<10;k++)
{
cout<<"Die "<<k+1<<". Zahl:\t"<<zahlen[k] << endl;
}
}*/
void main()
{
lotto player;
cout<<"Lotto\n";
player.lotto_zahlen_eingeben();
player.lotto_zahlen_ausgeben();
}
Hy ich soll für die Schule ein Lotto Programm in OOP schreiben, wo man 6 Zahlen eingibt, und die mit 6 generierten vergleivht werden, ich habe im moment probleme beim vergleichen