Advertisement
Guest User

Untitled

a guest
May 27th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <ctime>
  4. #define _USE_MATH_DEFINES
  5. #include <math.h>
  6.  
  7. using namespace std;
  8.  
  9. int *getRandom(){
  10. static int rndNumbers[6];
  11. srand((unsigned)time(0));
  12. for (int i=1; i<=6; i++){
  13. rndNumbers[i]=rand()%6+1;
  14.  
  15. }
  16. for (int i=1; i<=6; i++)
  17. cout<<rndNumbers[i];
  18. return rndNumbers;
  19. }
  20. int *eingabe(){
  21. static int meinfeld[6];
  22. for (int i=1; i <= 6; i++){
  23. cout<<"Gib die "<<i<<" Zahl ein";cin >> meinfeld[i];
  24. }
  25. for (int i=1; i<=6; i++)
  26. cout<<meinfeld[i];
  27. return meinfeld;
  28. }
  29. int *ausgaberandom(*rndNumbers){
  30. static int rndNumbers[6];
  31. for (int i=1; i<=6; i++)
  32. cout<<rndNumbers[i];
  33. return rndNumbers;
  34. }
  35. int *ausgabeeingabe(){
  36. static int meinfeld[6];
  37. for (int i=1; i<=6; i++)
  38. cout<<meinfeld[i];
  39. return meinfeld;
  40. }
  41. int *vergleich(){
  42. static int rndNumbers[6], ident, meinfeld[6];
  43.  
  44. if (rndNumbers[6] == meinfeld[6]){
  45. cout<<"you won\n";
  46. }
  47. if (rndNumbers[6] != meinfeld[6]){
  48. cout<<"you lost";
  49.  
  50.  
  51.  
  52. }
  53. return 0;
  54. }
  55.  
  56.  
  57. bool nochmals();
  58. void Preliminarien();
  59.  
  60. int main() {
  61. Preliminarien();
  62. do {
  63. system ("CLS");
  64.  
  65.  
  66. getRandom();
  67. cout<<"\n";
  68. eingabe();
  69. cout<<"\n";
  70. vergleich();
  71. cout<<"\n";
  72. ausgaberandom();
  73. cout<<"\n";
  74. ausgabeeingabe();
  75.  
  76.  
  77. } while (nochmals());
  78. }
  79.  
  80. bool nochmals() {
  81. cout << "\n\nWollen Sie diese Programm nochmals ablaufen lassen? (J/n)-> ";
  82. return toupper(_getch()) != 'N';
  83. } //nochmals
  84. void Preliminarien() {
  85. setlocale (LC_ALL, "German");
  86. srand (unsigned(time(0)));
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement