Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 132,331 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,134 people online right now. Registration is fast and FREE... Join Now!




help!

 
Reply to this topicStart new topic

help!, how can i display the highest scorer?

jencalma
post 15 Mar, 2008 - 04:09 AM
Post #1


New D.I.C Head

*
Joined: 13 Jul, 2007
Posts: 47


My Contributions


CODE
#include<iostream.h>
#include<conio.h>

int main()
{

//space bet.#1=9&ect=4

int x,y,a,b,col1,scr=0,pl=0,col2,scr1=0,row1=3,row2=5,x1,x2;
int inp[5][15],sum[3]={0,0,0},sam[3][15];
int holy,holx0,holx1,hold0,hold1,holder1,holder0;

for(a=1;a<=2;a++)
  {    for(b=1;b<=15;b++)
    {    inp[a][b]=0;
      sam[a][b]=0;}}

cout<<"player:  1    2    3    4    5    6    7    8    9    10   11   12   Total";
cout<<"\n\nTeam1:";
cout<<"\n\nTeam2:";

A:gotoxy (15,9);
cout<<"       ";
gotoxy (9,9);
cout<<"Team#:";
cin>>y;
{if(y>2)
goto A;}
B:gotoxy (14,11);
cout<<"       ";
gotoxy (9,11);
cout<<"Player#:";
cin>>x;
{if(x>12)
goto B;}

C:gotoxy (14,13);
cout<<"       ";
gotoxy (9,13);
cout<<"Score:";
cin>>inp[y][x];
{if(inp[y][x]>3)
goto C;}

{if(y==1&&x<=12)
{  {if(x==1)
col1=10;
else
col1=(5+(5*x));}

gotoxy (col1,row1);
sam[y][x]=sam[y][x]+inp[y][x];
cout<<sam[y][x];
gotoxy (73,row1);
sum[y]=sum[y]+inp[y][x];
cout<<sum[y];
goto A;}                                                                          

else if(y==2&&x<=12)
{    {if(x==1)
col2=10;
else
col2=(5+(5*x));}
gotoxy (col2,row2);
sam[y][x]=sam[y][x]+inp[y][x];
cout<<sam[y][x];
gotoxy (73,row2);
sum[y]=sum[y]+inp[y][x];
cout<<sum[y];
goto A;}

else
cout<<"\n\n\nWINNER:";
{if(sum[1]>sum[2])
    {cout<<"\tTeam 1";
   y=1;
   cout<<"\nHighest Scorer:";
       {    for(x1=1;x1<=2;x1++)

           {    for(x2=1;x2<13;x2++)
             {    if(scr<=sam[y][x2])
                {    scr=sam[y][x2];
               pl=x2;    }    }    }    }
               cout<<"Player "<<pl;}
   else if(sum[2]>sum[1])
   {cout<<"\tTeam 2";
   y=2;
   cout<<"\nHighest Scorer:";
       {    for(x1=2;x1<=3;x1++)

           {    for(x2=1;x2<13;x2++)
             {    if(scr<=sam[y][x2])
                {    scr=sam[y][x2];
               pl=x2;    }    }    }    }
               cout<<"Player"<<pl;}
   else
   cout<<"Draw";}}
           {for(holy=1;holy<=2;holy++)
          //    {for(holx=1;holx<=3;holx++)
                {for(holx0=1;holx0<13;holx0++)
                       {if(hold0<=sam[1][holx0])
                        {hold0=sam[1][holx0];
                        holder0=holx0;}
                     else //(hold1<=sam[2][holx0])
                        hold1=sam[2][holx0];
                        holder1=holx0;}}
                        {if(sam[1][holder0]>sam[2][holder1])
                                cout<<"\nTeam 1 Player "<<holder0;
                        else
                            cout<<"\nTeam 2 Player "<<holder1;}}






  // cout<<"\nHighest Scorer:";}
     //  {    for(x1=1;x1<=3;x1++)
         //        {    for(x2=1;x2<13;x2++)
         //     {    if(scr<=sam[y][x2])
         //       {    scr=sam[y][x2];
            //   pl=x2;    }    }    }    }
           //    cout<<"Player"<<pl;
//  if(sam[y][x1]>=sam[y][x2])
  //           cout<<sam[y][x1];
   //      x1=12;}}
   getch();

}




pls.. check my program... it has a little problem.... how can i display the highest scorer of the team if the two are draw in the total score??? and this is an example of a score board!!! thank for your help in advanced...

This post has been edited by jayman9: 15 Mar, 2008 - 08:32 AM
User is offlineProfile CardPM

Go to the top of the page

TheMagnitude
post 15 Mar, 2008 - 05:34 AM
Post #2


D.I.C Head

Group Icon
Joined: 12 Jan, 2008
Posts: 88



Dream Kudos: 125
My Contributions


Read the forum rules: http://www.dreamincode.net/forums/showtopic13117.htm
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 11/22/08 03:01AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month