![]() |
|
#1
|
|||
|
|||
Need help making a programHeres a descripton of what I need help making, It will be a console C++ program
" A deck of cards has 4 suits and 13 values in each suit. It contains 52 cards. The program needs to display the value and suit given a number. Hint: A suit is <value> % 4 where 0 is Hearts, 1 is Spades, 2 is Diamonds and 3 is Clubs. Use argc and argv in this program. " I really have no idea how to do something like this, i'm just a noob! Anybody help? |
|
#2
|
|||
|
|||
just a little helpyou should read a little to do it... its easier than you think...
here are some hints: CPP / C++ / C Code:
2) you take its value(s) and perform a modulo operation with 4 (var % 4) 3) if the result is 0 the suit is Hearts, if is 1 is Spades, 2 is Diamonds and 3 is Clubs 4) so use a conditional operator to do one thing or other depending on that 5) also depending on that you should peform some operation to the value(s) to find the value of the card being represented hope this helps... |
|
#3
|
|||
|
|||
|
Quote:
CPP / C++ / C Code:
Thats what I have right now, But I'm having trouble figuring out the value, like king queen jack 10 etc because i dont play cards! Any ideas? Last edited by LuciWiz : 25-Mar-2006 at 11:08.
Reason: Please insert your C++ code between [c++] & [/c++] tags
|
|
#4
|
|||
|
|||
|
Quote:
CPP / C++ / C Code:
I figured out how to find the value, you can see i'll just add 12 more ifs at the end, But I have no idea what names match what values!! Like what value is king etc! |
|
#5
|
|||
|
|||
|
oh so the main problem was actually a cards problem
card numbers go from 1 to 13... 1 is the as 2 to 10 are numbers 11 is jack 12 is queen 13 is king just some advice in your code: CPP / C++ / C Code:
|
|
#6
|
||||
|
||||
|
Build and run this program with different parameters at the console. It should give you an idea how to deal with the command line:
CPP / C++ / C Code:
__________________
Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough. -- Pearl Williams |
Recent GIDBlog
Python ebook by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need help with a C program (Long) | McFury | C Programming Language | 3 | 29-Apr-2004 21:06 |
| Modify a C program | ayoub | C Programming Language | 3 | 15-Mar-2004 12:34 |
| error during program | rjd72285 | C++ Forum | 0 | 11-Nov-2003 19:49 |
| one program access another? | dgoulston | C++ Forum | 1 | 07-Oct-2003 12:26 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The