All pastes #765560 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-11-08 03:51 UTC
rendered paste body
/* Mini Case Study - Blackjack */

#include <iostream.h>
#include <H:\lvp\random.h>

int main()
{
	randomize();

	int cards; //number of cards user wants to play with
	int ccards = 3;
	int r1; //player's cards randomized
	int r2; //computer's cards randomized
	int totaly; //adds up the value of cards
	totaly = 0;
	int totalc; //adds up the value of cards
	totalc = 0;
	

	cout << "How many cards do you want? "; 
	cin >> cards;

	cout << "You: ";
	for (; cards > 0; cards--) { 
		r1 = (random(10) + 1);
		cout << r1 << " ";
	if (r1 > 0) {
		totaly++;
	}
	}
	cout << endl;
	cout << "Computer: ";
	for (; ccards > 0; ccards--) { 
		r2 = (random(10) + 1);
		cout << r2 << " ";
	if (r2 > 0) {
		totalc++;
	}
	}
return(0);
}