Cards and Dice Lab with Loops.pdf
Above is the project. I am only doing the CARD DEALING as of now.
This is what I have so far for the CARDS. I'm having trouble outputting different cards and a bunch of other stuff........BASICALLY I'M EXTREMELY BEHIND IN THIS CLASS.
Code://Dice and Cards //by Lillian Wang #include <iostream.h> #include <string.h> #include <stdlib.h> #include <time.h> main() { int answer, cards, i; { cout<<"Welcome to Dice and Cards!"<<endl<<endl; cout<<"1-Roll Dice"<<endl; cout<<"2-Draw Random Cards"<<endl; cout<<"What would you like to do?(Please enter the number of choice): "; cin>>answer; if (answer==1) cout<<"How many rolls would you like?: "; if(answer==2) cout<<"How many cards would you like to draw?: "; cin>>cards; int card; char value; char suit; int deck[53]; srand((unsigned)time(NULL)); card=rand()%52+1; for (i=1; i<=cards; i++) { suit=(card-1)/13+3; int v=(card-1)%13+1; switch(v) { case 1: value='A'; break; case 10: value='T'; break; case 11: value='J'; case 12: value='Q'; break; case 13: value='K'; break; default: value=(char)(48+v); break; } cout<<value<<suit<<endl; } } return 0; }