Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <ctime>
- #define _USE_MATH_DEFINES
- #include <math.h>
- using namespace std;
- int *getRandom(){
- static int rndNumbers[6];
- srand((unsigned)time(0));
- for (int i=1; i<=6; i++){
- rndNumbers[i]=rand()%6+1;
- }
- for (int i=1; i<=6; i++)
- cout<<rndNumbers[i];
- return rndNumbers;
- }
- int *eingabe(){
- static int meinfeld[6];
- for (int i=1; i <= 6; i++){
- cout<<"Gib die "<<i<<" Zahl ein";cin >> meinfeld[i];
- }
- for (int i=1; i<=6; i++)
- cout<<meinfeld[i];
- return meinfeld;
- }
- int *ausgaberandom(*rndNumbers){
- static int rndNumbers[6];
- for (int i=1; i<=6; i++)
- cout<<rndNumbers[i];
- return rndNumbers;
- }
- int *ausgabeeingabe(){
- static int meinfeld[6];
- for (int i=1; i<=6; i++)
- cout<<meinfeld[i];
- return meinfeld;
- }
- int *vergleich(){
- static int rndNumbers[6], ident, meinfeld[6];
- if (rndNumbers[6] == meinfeld[6]){
- cout<<"you won\n";
- }
- if (rndNumbers[6] != meinfeld[6]){
- cout<<"you lost";
- }
- return 0;
- }
- bool nochmals();
- void Preliminarien();
- int main() {
- Preliminarien();
- do {
- system ("CLS");
- getRandom();
- cout<<"\n";
- eingabe();
- cout<<"\n";
- vergleich();
- cout<<"\n";
- ausgaberandom();
- cout<<"\n";
- ausgabeeingabe();
- } while (nochmals());
- }
- bool nochmals() {
- cout << "\n\nWollen Sie diese Programm nochmals ablaufen lassen? (J/n)-> ";
- return toupper(_getch()) != 'N';
- } //nochmals
- void Preliminarien() {
- setlocale (LC_ALL, "German");
- srand (unsigned(time(0)));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement