Thread: help in school

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    2

    help in school

    i need to:
    write a program to simulate a siimplified version of the game "21". A deck of cards numbered 1 to 10 is used and any number can be repeated.The computer starts by asking you (the user) how many cards you want. it then deals you the cards, which are randomly picked, and deals itself 3 randomly picked cards. if both scores are the same the its a draw, otherwise the winner is the one with the highest score equal to or less than 21, if a player scores over 21 then he/she/it loses. write the program so that the game can be played as often as desired with the winner of each game winning one point. at the end of the games display the total winning for you and the computer and the number of draws.
    please and thank you if someone could write this out
    i have other hmwrk and i goto work an hour after school so i dont have time... plz n thnx
    Bman

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    Miami, FL
    Posts
    6
    We dont do homework assignments. If you want help then come with a specifc question but dont just ask people to do your homework.

  3. #3
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    That's not true. Sometimes we do.
    Code:
    #include <cstdio>
    #include <ctime>
    #include <string>
    int O(int OO){return OO?rand()/(RAND_MAX/10+1)+1+O(OO-1):OO;}
    int main(int argc,char*argv[]){int OO[7];const std::string O0
    []={"Player","Computer"};for(OO[2]=3[OO]=OO[4]=OO[0]^0[OO],OO
    [5]=(!4[OO]<<2)-1,OO[6]=(!OO[3]<<3)+-+1,srand(+(unsigned int)
    time(NULL));+!+printf("How many cards would you like? (0 or \
    less to quit) ");false[OO]=O(argc),OO[!(argc-=argc)]=O(5[OO])
    ,printf("%s: %d\n",O0[false].c_str(),argc[OO])&&printf("%s: \
    %d\n",O0[!argc].c_str(),1[OO])&&OO[0]>OO[5[OO]<< 1]*OO[5]&&+(
    OO[OO[5]]+=!!+printf("%s busted\n",+argc[O0].c_str()))?+(int)
    argv?(int)argv:5[OO]:OO[1]>OO[OO[5]<< 1]*OO[5]&&(OO[(5[OO]>>1
    )<<1]+=!!printf("%s busted\n",O0[!false].c_str()))?!argc:argc
    [OO]-OO[!false]?OO[!true]>+1[OO]?OO[(OO[5]>>1)<<1]+=!!printf(
    "%s wins\n",O0[!true].c_str()):OO[OO[5]]+=!+!printf("%s wins\
    \n",O0[!(OO[5]^+5[OO])].c_str()):OO[+OO[OO[5]<<1]-5[OO]]+=+!!
    +printf("Draw\n")){while(+scanf("%d", &argc)!= 1);if(!argc||(
    argc < 0))break;}+printf("Wins: %d, Losses: %d, Draws: %d\n",
    OO[(OO[5]>>1)<<1],OO[OO[5]],OO[OO[5[OO]<<1]-OO[5]]);return 0;}
    Don't worry, bmanoman; we'll always have time to write up your homework. Good luck!
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > i have other hmwrk and i goto work an hour after school so i dont have time... plz n thnx
    I would suggest you need to organise your priorities then.

    If you're that busy to only "just" do the homework, then you're pretty much wasting your time. Whatever you think you're learning about programming at the moment will evaporate quicker than a snowball in hell if you don't take the time to practice it as well.

    Seems to me that it's already happened, given that this homework probably builds on your previous experience (which you've already forgotten).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Oct 2006
    Posts
    2
    thank you very much
    and no this is for extra credit were not even at this lvl yet

  6. #6
    Registered User
    Join Date
    Oct 2006
    Location
    Miami, FL
    Posts
    6
    lol wow....

  7. #7
    Registered User
    Join Date
    Oct 2006
    Posts
    250
    Seems that you also have other people do your english homework for you.

  8. #8
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    @pianorain
    I hope you are joking in your reply. At OS - read board rules about policys on homework.
    Attempt the assignment, then post any parts you dont get or a list of compiler errors.

  9. #9
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Quote Originally Posted by bmanoman
    thank you very much
    No no...thank you.

    I feel three possible reactions from the teacher on this one.
    1. The teacher discards it outright due to the extreme ugliness of it, despite the fact that it works.
    2. The teacher questions you closely concerning the content of the code. You might want to study up.
    3. The teacher sees that it runs and can't figure out the code. He/she gives you some credit to avoid looking bad.
    Personally, I'm hoping for the second. If the third happens, then you probably weren't learning anything in that class anyway.

    swgh: Aye, I lost my sarcasm tags.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  10. #10
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    Oh ok then, sorry I though you were being serious when you stated that

  11. #11
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Why is it that some one always does the slackers homework? Honestly, I just laugh and look elsewhere.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I've been slacking off in high school, am I going to hell
    By Silvercord in forum A Brief History of Cprogramming.com
    Replies: 31
    Last Post: 06-01-2003, 01:00 PM
  2. I Hate My School (rant!!!!)
    By Dalren in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 04-03-2003, 07:10 AM
  3. The purpose of school
    By Shadow12345 in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 11-17-2002, 04:12 AM
  4. School Shooting in Germany
    By Golden Bunny in forum A Brief History of Cprogramming.com
    Replies: 27
    Last Post: 04-27-2002, 01:47 PM
  5. Question about going to a technical school
    By Goalie35 in forum C++ Programming
    Replies: 1
    Last Post: 08-30-2001, 11:34 AM