c++ game [code] need help

This is a discussion on c++ game [code] need help within the Game Programming forums, part of the General Programming Boards category; arranged a squash closed tournament of which ten students have been chosen to participate in this prestigious annual event. The ...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    1

    c++ game [code] need help

    arranged a squash closed tournament of which ten students have been chosen to participate in this prestigious annual event. The ten students will form two teams namely Team A and Team B of five each.

    Before the tournament starts, there will be an exhibition game between two students taken at random from Team A and Team B.

    As a coordinator of this tournament coupled with your skills in C++ programming, you have a challenge to write a program in C++ that will be able perform the following:

    Accept names of ten students in Teams A and B.
    Pick one student at random from Team A and one from Team B for the exhibition game.
    Pair the Team A and Team B for the main games. Note: Your program should pair students from the two teams at random.



    Hint:
    Use rand() function for random selection
    Use multidimensional arrays to capture your team members
    Use user defined functions: You may consider the following:
    a function to accept input (Members of both teams),
    a function to perform randomizing
    a function to select students to play the exhibition game
    a function to generate the main games


    Code:
    #include<iostream.h>
    #include<iomanip.h>
    #include<string>
    #include<cstdlib>
    #include<time.h>
    
    void Getnames(char [5][20]);
    void Display(char [5][20]);
    char randomize(char [5][20]);
    void Exhibition(char [5][20]);
    
    int main()
    {
    	
    		cout<<"Polytechnic of Namibia squash tournament "<<endl;
    		char TeamA[5][20], TeamB[5][20], EXgame[5][20];
    
    	
    	
    	cout<<"Please enter Team A"<<endl;
    	Getnames(TeamA);
    	cout<<"THE FOLLOWING ARE MEMBERS OF TEAM A "<<endl;
    	Display(TeamA);
    	cout<<endl;
    
    	cout<<"Please enter Team B"<<endl;
    	Getnames(TeamB);
    	cout<<"THE FOLLOWING ARE MEMBERS OF TEAM B "<<endl;
    	Display(TeamB);
    	cout<<endl;
    	
    	cout<<"the following is an exhibition game "<<endl;
    	Display(TeamA);
    	cout<<" "<<endl;
    	
    	return 0;
    }
    
    void Getnames(char names[5][20]){
    	for(int i=0; i<5; i++)
    	{
    		
    
    		cin>>names[i];
    		
    
    	}
    }
    
    void Display(char names[5][20])
    {
    	for(int i=0; i<5; i++)
    	{
    			
    			cout<<names[i]<<" "<<endl;
    			cout<<"  "<<endl;
    			
    		}
    		
    	}
    
     
    	void randomiz(void)
    	{
    		char names;
    		names=rand()%5+1;
    		cout<<names;
    	}
    /*void Exhibition(char t[5][5])
    {
    	t[0] = randomize();
    	for(int i=0; i<5; i++)
    	{
    		t[i] = randomize();
    		for(int j=0; j<5; j++){
    			while(t[i]==t[i]){
    				t[i] = randomize();
    			}
    		}
    	}
    }*/

  2. #2
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    I'm not saying anything.
    Pointers and gaming - MARIO
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  3. #3
    Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Posts
    2,595
    Please do not cross post and please post questions in appropriate places. Failure to follow these rules may result in banning.
    Kermi3

    If you're new to the boards, welcome and reading this will help you get started.
    Information on code tags may be found here

    - Sandlot is the highest form of sport.

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452
    I see
    - a list of requirements
    - some code
    But NO question....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-07-2010, 11:08 PM
  2. game engine advice?
    By stien in forum Game Programming
    Replies: 0
    Last Post: 01-23-2007, 02:46 PM
  3. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 12:48 AM
  4. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM

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