Like Tree20Likes
  • 2 Post By phantomotap
  • 1 Post By Alan.Brown
  • 2 Post By manasij7479
  • 2 Post By phantomotap
  • 1 Post By claudiu
  • 1 Post By ledow
  • 11 Post By Salem

i dont know what to put for a title here.

This is a discussion on i dont know what to put for a title here. within the C Programming forums, part of the General Programming Boards category; hey i want to know HOW DO YOU PUT THINGS IN ORDER. FOR EXAMPLE (PAY ATTENTION TO THIS BIT) JOHN ...

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    99

    i dont know what to put for a title here.

    hey i want to know HOW DO YOU PUT THINGS IN ORDER. FOR EXAMPLE (PAY ATTENTION TO THIS BIT) JOHN HAS 10 APPLES OVER ALL , SARAH HAS 7 APPLES, PETER HAS 4 APPLES AND KATE HAS 2 APPLES. INSTEAD OF PRINTING OUT IN UN-DESCENDING ORDER I WANT TO PRINT THEM OUT IN DESCENDING ORDER FROM GREATEST TO LEAST AMOUNT OF APPLES EACH HAS BUT THE PROBLEM IS GUYS.... GUESS WHAT??? I WONT KNOW HOW MANY APPLES THEY WILL EACH HAVE AT THE END OF APPLE PICKING. SO INSTEAD OF GOING "IF JOHN HAS GREATER APPLES THAN SARAH AND GREATER APPLES THAT KATE AND GREATER APPLES THAN KATE... THEN PUT HIM AT THE TOP OF THE TABLE. AND THEN GOING WELL IF JOHN DOESNT HAVE THE MOST APPLES AND KATE HAS MORE THAN JOHN BUT LESS THAN PETER BUT MORE THAN SARAH THEN PUT HER SECOND AND BLA BLA BLA BLA...!!! I WANT TO FIND OUT A SIMPLE WAY OF SORTING THINGS. PLEASE HELP. YOU CAN SENSE MY FRUSTRATION. HERE IS MY CODE OF A LEAGUE TABLE WITH A SIMILAR ISSUE BECAUSE I WANT TO SORT OUT WHO GOES AT THE TOP OF THE TABLE, THEN SECOND AND SO ON UNTIL LAST ACCORDING TO THEIR OVERALL POINTS WHICH ARE ACCUMULATED BY WINNING AND DRAWING GAMES!!!!!!!!!!

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    
    struct bones
    {
        char name[20];
        int played;
        int scored;
        int won;
        int drawn;
        int lost;
        int points;
    
    
    };
    
    
    
    
    struct bones team[4];
    
    
    
    
    int main()
    {
        int i;
       
    
    
        for(i=0;i<4;i++)
        {
            team[i].played = 0;
            team[i].won = 0;
            team[i].scored = 0;
            team[i].lost = 0;
            team[i].drawn = 0;
            team[i].points = 0;
        }
    
    
    
    
        for(i=0;i<4;i++)
        {
            printf("enter each team name\n");
            fgets(team[i].name, 20, stdin);
        }
    
    
    
    
        for(i=1;i<4;i++)
        {
            printf("%s \tvs\t%s\n",team[0].name,team[i].name);
            printf("%s \tscore:",team[0].name);
            scanf("%d",&team[0].scored);
            printf("%s \tscore:",team[i].name);
            scanf("%d",&team[i].scored);
            team[0].played++;
            team[i].played++;
    
    
    
    
            if(team[0].scored > team[i].scored)
            {
                team[0].won++;
                team[0].points += 3;
                team[i].lost++;
            }
            else if(team[0].scored == team[i].scored)
            {
                team[0].drawn++;
                team[i].drawn++;
                team[0].points += 1;
                team[i].points += 1;
            }
            else
            {
                team[i].won++;
                team[i].points += 3;
                team[0].lost++;
            }
    
    
        }
        for(i=2;i<4;i++)
        {
            printf("%s \tvs\t %s\n",team[1].name,team[i].name);
            printf("%s \tscore:",team[1].name);
            scanf("%d",&team[1].scored);
            printf("%s \tscore:",team[i].name);
            scanf("%d",&team[i].scored);
            team[1].played++;
            team[i].played++;
    
    
    
    
            if(team[1].scored > team[i].scored)
            {
                team[1].won++;
                team[1].points += 3;
                team[i].lost++;
            }
            else if(team[1].scored == team[i].scored)
            {
                team[1].drawn++;
                team[i].drawn++;
                team[1].points += 1;
                team[i].points += 1;
            }
            else
            {
                team[i].won++;
                team[i].points += 3;
                team[1].lost++;
            }
    
    
        }
        for(i=3;i<4;i++)
        {
            printf("%s \tvs\t %s\n",team[2].name,team[i].name);
            printf("%s \tscore:",team[2].name);
            scanf("%d",&team[2].scored);
            printf("%s \tscore:",team[i].name);
            scanf("%d",&team[i].scored);
            team[2].played++;
            team[i].played++;
    
    
    
    
            if(team[2].scored > team[i].scored)
            {
                team[2].won++;
                team[2].points += 3;
                team[i].lost++;
            }
            else if(team[2].scored == team[i].scored)
            {
                team[2].drawn++;
                team[i].drawn++;
                team[2].points += 1;
                team[i].points += 1;
            }
            else
            {
                team[i].won++;
                team[i].points += 3;
                team[2].lost++;
            }
    
    
        }
        
    
    
                            printf("team    played    won    drawn    lost    points\n");
                            printf("\n");
                            for(i=0;i<4;i++)
                            {
                                printf("%s          %d       %d       %d       %d       %d",team[i].name,team[i].played,team[i].won,team[i].drawn,team[i].lost,team[i].points);
                                printf("\n");
                            }
    return(0);
    }

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,231
    O_o

    ...and now you are stomping on the keyboard?

    The last week you've posted dozens of problems with essentially this same program; you've been having people here write your code for you a few lines and a couple problems at a time.

    Why don't you stop trying to solve this problem which you are clearly and painfully not ready to tackle? Why don't you get yourself a good book, do the exercises, and actually learn to program. If you would just stop trying to do this by cobbling together your own guesswork with the notes forum regulars have offered you'd see that this program isn't nearly as difficult as you've managed to make it.

    The problem you've described here, for all of its rampant stupidity, has already been solved by an earlier thread.

    Soma
    rags_to_riches and Salem like this.

  3. #3
    Registered User
    Join Date
    Feb 2012
    Posts
    99
    ok jump off your high horse their because even though i have asked a few question i actually figured out my SMALL mistakes MYSELF because people like you seem to not want to offer a few keystrokes out of your life to someone who wants to learn and SOOME PEOPLE FIND IT HARD TO LEARN IF ITS NOT FROM SOMEONE ELSE'S HELP OR EXPLAINATION just like a baby learns from diagrams so learns visually. so to be honest the only thing i really do need help on is this sorting part because i have looked it up everywhere and just cannot get to grips with it so i came here because maybe by off chance someone here has done these types of things before who may lend a hand to me unlike you who wants to bark at me. YOU JUST WASTED YOUR TIME YOU KNOW, and guess what??... it's a forum so make use of this service. thanks for wasting my time and yours.

  4. #4
    Registered User
    Join Date
    Feb 2012
    Posts
    99
    and by the way enough of the exaggeration. "you have posted dozens of problems". ehm no i havent actually. if you want to throw abuse at me at least get it right.

  5. #5
    Registered User Alan.Brown's Avatar
    Join Date
    Jul 2010
    Location
    NSW, Australia
    Posts
    9
    Quote Originally Posted by ingeniousreader View Post
    ok jump off your high horse their because even though i have asked a few question i actually figured out my SMALL mistakes MYSELF because people like you seem to not want to offer a few keystrokes out of your life to someone who wants to learn and SOOME PEOPLE FIND IT HARD TO LEARN IF ITS NOT FROM SOMEONE ELSE'S HELP OR EXPLAINATION just like a baby learns from diagrams so learns visually. so to be honest the only thing i really do need help on is this sorting part because i have looked it up everywhere and just cannot get to grips with it so i came here because maybe by off chance someone here has done these types of things before who may lend a hand to me unlike you who wants to bark at me. YOU JUST WASTED YOUR TIME YOU KNOW, and guess what??... it's a forum so make use of this service. thanks for wasting my time and yours.
    Not the way to talk to someone who has taken the time and trouble to answer your post and offer some suggestions. You are wasting the time of all the people in here who give their time and experience to help others.

    Go learn some manners - maybe before you reach puberty!

    Salem likes this.

  6. #6
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by ingeniousreader View Post
    hey i want to know HOW DO YOU PUT THINGS IN ORDER. FOR EXAMPLE (PAY ATTENTION TO THIS BIT) JOHN HAS 10 APPLES OVER ALL , SARAH HAS 7 APPLES, PETER HAS 4 APPLES AND KATE HAS 2 APPLES. INSTEAD OF PRINTING OUT IN UN-DESCENDING ORDER I WANT TO PRINT THEM OUT IN DESCENDING ORDER FROM GREATEST TO LEAST AMOUNT OF APPLES EACH HAS BUT THE PROBLEM IS GUYS.... GUESS WHAT??? I WONT KNOW HOW MANY APPLES THEY WILL EACH HAVE AT THE END OF APPLE PICKING. SO INSTEAD OF GOING "IF JOHN HAS GREATER APPLES THAN SARAH AND GREATER APPLES THAT KATE AND GREATER APPLES THAN KATE... THEN PUT HIM AT THE TOP OF THE TABLE. AND THEN GOING WELL IF JOHN DOESNT HAVE THE MOST APPLES AND KATE HAS MORE THAN JOHN BUT LESS THAN PETER BUT MORE THAN SARAH THEN PUT HER SECOND AND BLA BLA BLA BLA...!!! I WANT TO FIND OUT A SIMPLE WAY OF SORTING THINGS. PLEASE HELP. YOU CAN SENSE MY FRUSTRATION. HERE IS MY CODE OF A LEAGUE TABLE WITH A SIMILAR ISSUE BECAUSE I WANT TO SORT OUT WHO GOES AT THE TOP OF THE TABLE, THEN SECOND AND SO ON UNTIL LAST ACCORDING TO THEIR OVERALL POINTS WHICH ARE ACCUMULATED BY WINNING AND DRAWING GAMES!!!!!!!!!!
    You pay attention to this bit: Read the forum guidelines and try to post without sounding like a total troll.

    Has it ever occurred to you, even remotely perhaps, that the reason people don't offer help has nothing to do with your code? IT'S YOU!
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  7. #7
    Registered User
    Join Date
    Feb 2012
    Posts
    99

    reply

    Quote Originally Posted by claudiu View Post
    You pay attention to this bit: Read the forum guidelines and try to post without sounding like a total troll.

    Has it ever occurred to you, even remotely perhaps, that the reason people don't offer help has nothing to do with your code? IT'S YOU!
    no its you people because nobody has any manners here . you are all hot headed frustrated people who just want to fight all the time. i love to help people unike you people. sometimes i would go " how do you declare an int for example" not that i would need to know that but the first comment would be "well you should try work it out for yourself" then i would go "well the reason im here is to learn and because i dont know how to do it" and then they would go "bark bark bark" so they waste my time and theirs. instead they should say " ok david this is how you should do it , here is my help because i know how to do it and i want to teach others instead of being stuck up bitc**** and not offering what they know.

  8. #8
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    Read this before you dig a deeper hole.
    How To Ask Questions The Smart Way
    stahta01 and Salem like this.
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  9. #9
    Registered User
    Join Date
    Dec 2011
    Posts
    795
    Quote Originally Posted by ingeniousreader View Post
    no its you people because nobody has any manners here . you are all hot headed frustrated people who just want to fight all the time. i love to help people unike you people. sometimes i would go " how do you declare an int for example" not that i would need to know that but the first comment would be "well you should try work it out for yourself" then i would go "well the reason im here is to learn and because i dont know how to do it" and then they would go "bark bark bark" so they waste my time and theirs. instead they should say " ok david this is how you should do it , here is my help because i know how to do it and i want to teach others instead of being stuck up bitc**** and not offering what they know.
    Not gonna try and read that huge wall of whine...

    But Claudiu was right, it's not that we don't want to help. We've helped many people that show a bit of decency and intelligence asking questions. But you need to understand that there's a difference between helping and tutoring -- and it sounds like you need the latter.

    > the first comment would be "well you should try work it out for yourself"
    Of course it would! We shouldn't and won't answer questions that can easily be googled, it's a waste of time for both parties. And you're learning nothing in the process, when someone's spoon-feeding you all of the information.

    > instead they should say " ok david this is how you should do it , here is my help because i know how to do it and i want to teach others instead of being stuck up bitc****
    It's funny that you think we're here to teach you, and arrogant that you think that our failure to do so is "being stuck up bitc****".

    There's just a point where we don't feel like answering retarded questions about your ........ing "league table" for the twentieth time. Do yourself a favor and use Google.

  10. #10
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,231
    Code:
    nobody has any manners
    you are all hot headed
    being stuck up bitc****
    Well, I can't speak for the rest of you, but I am convinced that he is a changed man ready and willing to work with us.

    Soma
    memcpy and claudiu like this.

  11. #11
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by ingeniousreader View Post
    no its you people because nobody has any manners here . you are all hot headed frustrated people who just want to fight all the time. i love to help people unike you people. sometimes i would go " how do you declare an int for example" not that i would need to know that but the first comment would be "well you should try work it out for yourself" then i would go "well the reason im here is to learn and because i dont know how to do it" and then they would go "bark bark bark" so they waste my time and theirs. instead they should say " ok david this is how you should do it , here is my help because i know how to do it and i want to teach others instead of being stuck up bitc**** and not offering what they know.
    If people have no manners here and are all stuck up bitc**** who whine all the time and help nobody why do you keep coming back?
    ledow likes this.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  12. #12
    Registered User ledow's Avatar
    Join Date
    Dec 2011
    Posts
    435
    Really... I hope you spoke to all your teachers like that. There'd have been a few whacks around the earhole coming to you if you'd tried that during the years I went to school.

    "I don't know how to" - "Try and work it out for yourself" - "No, you're stuck up ..........es, just do it for me" - WHACK!

    The difference being that they are paid professionals whose sole job was to teach you, no matter what, and we're random people on a forum for people with similar interests who don't get paid and where the only incentive to help you is your gratitude.

    I work in schools. If a 6-year-old spoke to me like that, they'd be before the head/principal before they got another word out. If I wouldn't tolerate it from a 6-year-old in a paid job, what makes you think I'd tolerate it from someone older where I'm not being paid? Scrap that, what makes you think I'd tolerate that at all?

    I'd hazard that you just got yourself informally blacklisted from any help by a large number of regular forum members.
    memcpy likes this.

    - Compiler warnings are like "Bridge Out Ahead" warnings. DON'T just ignore them.
    - A compiler error is something SO stupid that the compiler genuinely can't carry on with its job. A compiler warning is the compiler saying "Well, that's bloody stupid but if you WANT to ignore me..." and carrying on.
    - The best debugging tool in the world is a bunch of printf()'s for everything important around the bits you think might be wrong.

  13. #13
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,497
    If you think this thread should have been closed, press the "like" link at the bottom right of this post.

    If you think it was a mistake to close this thread, press ALT-F4
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I'm not sure how to title this.
    By blacksheepnb in forum C++ Programming
    Replies: 8
    Last Post: 05-18-2008, 07:22 AM
  2. You title it.
    By siavoshkc in forum C++ Programming
    Replies: 3
    Last Post: 03-03-2006, 08:48 AM
  3. if you dont like linux threads, dont read...
    By ... in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 02-03-2003, 10:26 AM
  4. My title.
    By Govtcheez in forum A Brief History of Cprogramming.com
    Replies: 32
    Last Post: 01-25-2002, 04:56 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21