Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- struct card
- {
- int suit;
- int number;
- };
- string getsuit(int x)
- {
- if(x==1)
- return "spades";
- else if(x==2)
- return "hearts";
- else if(x==3)
- return "clubs";
- else if(x==4)
- return "diamonds";
- }
- string getnumber(int y)
- {
- if(y==2)
- return "2";
- if(y==3)
- return "3";
- if(y==4)
- return "4";
- if(y==5)
- return "5";
- if(y==6)
- return "6";
- if(y==7)
- return "7";
- if(y==8)
- return "8";
- if(y==9)
- return "9";
- if(y==10)
- return "10";
- if(y==11)
- return "ace";
- if(y==12)
- return "king";
- if(y==13)
- return "queen";
- if(y==14)
- return "jack";
- }
- int main()
- {
- int n,i;
- struct card a;
- cin>>n;
- for(i=1; i<=n; i++)
- {
- cin>>a.suit>>a.number;
- cout<<"card "<<i<<" is of "<<getnumber(a.number)<<" of "<<getsuit(a.suit)<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment