Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //olivia
- //simple card game
- #include <iostream>
- #include <time.h>
- #include <stdlib.h>
- using namespace std;
- int main ()
- {
- int p1[10], p2 [10];
- int newnumber1;
- int newnumber2;
- srand(time(NULL));
- int score1=0;
- int score2=0;
- int winner;
- cout<<"Welcome to my ~Card Game~ get ready for a fun game! :)"<<endl;
- for (int i=0; i<=11; i++)
- {
- cout<<"Round "<<i<<endl;
- newnumber1 = rand()%14;
- cout<<"Player 1 drew this card: "<<newnumber1<<endl;
- newnumber2 = rand()%14;
- cout<<"Player 2 drew this card: "<<newnumber2<<endl;
- if (p1 [i] > p2 [i])
- {
- score1=score1 +1;
- cout<<"Player 1 wins the round! They have been awarded 1 point!"<<endl;
- }
- if (p1 [i] < p2 [i])
- {
- score2=score2 +1;
- cout<<"Player 2 wins the round! They have been awarded 1 point!"<<endl;
- }
- }
- if (score1>score2)
- {
- winner=1;
- }
- if (score1<score2)
- {
- winner=2;
- }
- cout<<"Well, that was fun! :) Here are the final scores! Player 1 has "<<score1<<"points!! Player 2 has "<<score2<<" points!!"<<endl;
- cout<<"The winner of this game is....Player "<<winner<<"!!!!!"<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement