Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <ctime>
- using namespace std;
- bool noAmoi();
- void Wurf_Eingaben(int Sp[6]);
- void Wurf_Erzeugen(int Computer[6]);
- void Wurf_Ausgeben(int Computer[6]);
- int Punkt_Erster(int Sp1[6],int Sp2[6]);
- void main () {
- cout<<"* * * W u e r f e l s p i e l * * *";
- int Sp[6];
- int Computer[6];
- int Punkte_Sp;
- int Punkte_Computer;
- do{
- Wurf_Eingaben(Sp);
- Wurf_Erzeugen(Computer) ;
- cout<<"\nComputer :";
- Wurf_Ausgeben(Computer);
- cout<<"\nSpieler : ";
- Wurf_Ausgeben(Sp);
- Punkte_Sp=Punkt_Erster(Sp,Computer);
- Punkte_Computer = Punkt_Erster(Sp,Computer);
- cout<<"\n"<<Punkte_Sp;
- }while (noAmoi());
- }
- bool noAmoi() {
- cout<<"\n\nWollen Sie das Programm neustarten (j/n)";
- return toupper(_getch())!='N';
- }
- void Wurf_Eingaben(int Sp[6]) {
- for(int i=1;i<=5;i++){
- cout<<"\nIhr " << i <<".Wurf : ";
- cin>>Sp[i];
- }
- }
- void Wurf_Erzeugen(int Computer[6]) {
- srand((unsigned)time(0));
- for(int i=1;i<=5;i++){
- Computer[i]=rand()%6+1 + rand()%6+1;
- }
- }
- void Wurf_Ausgeben(int Computer[6] ) {
- for(int i=1;i<=5;i++){
- cout<<Computer[i]<<" ";
- }
- }
- int Punkt_Erster(int Sp1[6],int Sp2[6]) {
- int Punkte_Sp1;
- for(int i=1;i<=5;i++){
- if(Sp1[i]>Sp2[i])
- Punkte_Sp1=Punkte_Sp1+3;
- if(Sp1[i]==Sp2[i])
- Punkte_Sp1=Punkte_Sp1+1;
- }
- return Punkte_Sp1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement