#include <iostream>
#include <string>
#include <ctime>
#include <cstdlib>

using namespace std;

string ace;
string two;
string three;
string four;
string five;
string six;
string seven;
string eight;
string nine;
string ten;
string jack;
string queen;
string king;
string hearts;
string diamonds;
string clubs;
string spades;

int main ()

string faceValue [13] = {ace, two, three, four, five, six, seven, eight, nine, ten, jack, queen, king};
string suit [4]= {hearts, diamonds, clubs, spades};

int card0;
int card1;

string suit0;
string suit1;

card0 = (1 + rand() % 13);
card1 = (1 + rand() % 13);

if (card0 < card1){
cout << card0 << " is less than " << card1;

if (card0 == card1){
cout << card0 << " is equal to " << card1;

if (card0 > card1){
cout << card0 << " is greater than " << card1;

return 0;

I have to create a program which uses a function to randomly sets the suit and facevalue of a playing card. Create another function that tests if one card is greater than another. Then write a program that uses the 2 functions to repeatedly set and display the values of 2 ramdom cards until 5 of the card pairs compare as the first is greater than the second.
Topic archived. No new replies allowed.