1
2
3
4
5
6
7
8
9
10
//DeckOfCards.h class Deckofcards { public: Deckofcards(); void shuffle(); void deal(); private: int deck[4][13]; };
1
2
3
4
5
6
7
8
9
10
11
//client.cpp #include "DeckOfCards.h" int main() { Deckofcards deckofcards; deckofcards.shuffle(); deckofcards.deal(); return 0; }//end main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//Deckofcards.cpp #include <iostream> using std::cout; using std::left; using std::right; #include <iomanip> using std::setw; #include <cstdlib> using std::rand; using std::srand; #include <ctime> using std::time; #include "DeckOfCards.h" Deckofcards::Deckofcards() { for (int row = 0; row <= 3; row++ ) { for (int column = 0; row <= 12; column++) { deck[row][column] = 0; //slot of deck is 0 }//end column for }//end row for srand(time(0));//seed random number }//end Deckofcards constructor void Deckofcards::shuffle() { cout << "hit"; int row; //suit of card int column; //face of card for (int card = 1; card <=52; card++) { do { row = rand()%4; column = rand()%13; } while( deck[row][column] !=0);//end do...while deck [row][column] = card; }//end for }//end shuffle void Deckofcards::deal() { cout << "hit"; static const char *suit[4] = {"Hearts", "Diamonds", "Clovers", "Spades"}; static const char *face[13] = {"Ace", "Deuce", "Three", "Four", "Five", "Six", "Seven" , "Eight", "Nine", "Ten", "Jack", "Queen", "King" }; for (int card = 1; card <=52; card++) { for (int row = 0; row <= 3; row++) { for (int column = 0; column <= 12; column++) { if (deck[row][column] == card) { cout << setw(5) << right << face[column] << " of " << setw(8) << left << suit[row] << (card %2 == 0 ? '\n' : '\t'); }//end if }//end for }//end for }//end for }//end deal
#include<stdio.h>
You can write a C++ fib pro using arrays but the problem is the prog becomes very complicated since u need to pass the next adding value in an array.....
huh?
How to write a program for secant method by mathematica
write a lex program to delete space from the program
abdulrahman
#include<stdio.h>
http://www.assignmentsclub.com/
Yes.
You can write a C++ fib pro using arrays but the problem is the prog becomes very complicated since u need to pass the next adding value in an array.....
int main (int,char* argv[]) { int i, for (i=0;i<arg;++i) printf ("% 2d:% s\a";i,argv[i]); return o; }
No. An array is a collection of objects of any type, such as doubles, not just characters. You can even have arrays of arrays, or arrays of structs. In C, the size of an array is fixed, but it is possible to write code that will allow you to manually make it variable in size.
How to write a program for secant method by mathematica
huh?
write a lex program to delete space from the program
write a vb program to find the magic square
write a program to multily 3*3 matrix.