#include <iostream> #include "Course.h" using namespace std; int main(int argc, char *argv[]) { string pname; char choice; cout << "Welcome to Blackjack!" << endl; cout << "Enter your player name: "; cin >> pname; cout << endl; cout << "Ready to play " << pname << "? Y/N" << endl; cin >> choice; // do // { if(choice == 'Y') { system("cls"); cout << "---------BlackJack---------" << endl << endl; Game card(); card.card1(); } else if (choice == 'N') { system("pause"); return EXIT_SUCCESS; } else { cout << "Please enter Y or N" << endl << endl; cin >> choice; } // } // while(choice != 'Y' || choice != 'N'); system("PAUSE"); return EXIT_SUCCESS; }</iostream>
using namespace std; class Game { public: Game(){} Game(int irandom) { randomvalue = irandom; } ~Game(){} int card1() { cout << "The value of your first card is: "; random(); cout << randomvalue << endl << endl; return randomvalue; system("pause"); } int random() { int a; srand(time(0)); randomvalue=(rand()%11)+1; return randomvalue; } protected: int randomvalue; };
Game card();
Game card;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)