Thread: some easy help needed

  1. #1
    Registered User
    Join Date
    Dec 2001

    some easy help needed

    Ok, suppose two teams are playing a game against each other, and the winner will advance to the next round. I have to randomly choose one out of two teams chosen, based on their rank out of 16, to advance. How would I do this using RandGen? The team ranked 1 will play 16, rank 2 plays 15, rank 3 plays 14... etc.

    and for the rank 1 against rank 16 game, the odds are in rank 1's favor, except there is sitll a chance of rank 16 winning.

    thanks a lot for help.
    Last edited by kv2; 03-14-2002 at 12:19 AM.

  2. #2
    I'm Back
    Join Date
    Dec 2001

    int t1,t2;


    goto re;

    cout<<"TEAM "<<t1<<" chosen";
    cout<<"TEAM "<<t2<<" chosen";


    not tested program/code

    random() = stdlib.h

    random(17) = randomely selects any num from 0 to 16, that's why i added 1 to t1,t2

    if you don't want goto [nobody likes it] use do-while. it's better but goto is simple.

  3. #3
    Registered User
    Join Date
    Dec 2001
    this is the code my teacher gave us to look at.
    it doesn't go up to the final four or the semifinals.
    struct region
    apstring name;
    void main()
    //East Midwest South West
    ifstream infile;"bracket.dat",ios::in);
    for(int i=0; i<4; i++)
    getline(infile, bracket[i].name);
    for(int j = 1; j <=16; j++ )
    getline(infile, bracket[i].teams[j]);
    RandGen n;
    // games in a region
    for( i = 0; i<4; i++ )
    cout<<bracket[i].name<<" Region\n";
    for(int j=1; j<=8; j++)
    int t = n.RandInt(1,17);
    cout<<"Game "<< j << endl;
    <<" vs. "

    cout<<"Winner is ";
    if(j < 17 - t)
    cout << bracket[i].teams[j] << endl;
    cout << bracket [i].teams[17-j] << endl;

    cin.get();// creates a pause between brackets
    system("cls");// clear the screen


    //end code

    ok i dont get the ........

    cout<<"Winner is ";
    if(j < 17 - t)
    cout << bracket[i].teams[j] << endl;
    cout << bracket [i].teams[17-j] << endl;

    ........ part of that

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. free needed or not?
    By quantt in forum Linux Programming
    Replies: 3
    Last Post: 06-25-2009, 09:32 AM
  2. C Programmers needed for Direct Hire positions
    By canefan in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 09-24-2008, 11:55 AM
  3. Easy question, (should be) easy answer... ;-)
    By Unregistered in forum A Brief History of
    Replies: 1
    Last Post: 06-12-2002, 09:36 PM
  4. Replies: 20
    Last Post: 05-25-2002, 07:14 PM
  5. EASY GUI development.. like with Qt?
    By rezonax in forum C++ Programming
    Replies: 2
    Last Post: 09-16-2001, 01:18 PM