Hello,
I tried to work through your program but, I have to admit, I failed in understanding everything.
I know that gotxy() is a very nice function. But in your case I strongly suggest not to use it for the following reason:
Debugging gets pretty hard because it is difficult to find out which cin-statement belongs to which cout-statement.
Your code does not become clearer, it gets more complicated.
Now, to your program in whole. The
is the same as r = 0 because there is no other value r is allowed to have.
1 2 3 4 5 6
|
t1[0][0]=tn;
(...)
t1[0][6]=tn;
g[0][0]=gn;
(...)
g[0][7]=gn;
|
Why do you set all values to the same value (tn or gn)?
------
I would suggest the following:
Re-write (if you already have one) the pseudo-code of your program. The pseudo-code consits of short sentences that describe the steps of your software.
Then, after you defined the steps your program has to run through, try to code these steps one by one. If one module (or in that matter part of the code) is working, start with the next one.
You are using arrays, so really use them. Do not use different arrays for each team. Instead, use one two-dimentional-array as you have already tried but not succeeded.
There is no complex idea behind arrays, if you want to enter the score for team one, game six, the corresponding variable would be score[0][5] (c++ starts counting with 0, not with 1, that's why the index is smaller by one).
If you think this concept through, you will find out that setting a score only requires the input of team-number, game-number and the score. There are no if-thens required. You can then set the values directly.
Adding up the values is easy after that as well. Just iterate through the array and add its elements.
It may sound harsh but you would probably be better off starting anew.
And please, use the code brackets for inserting code. It is the icon with --> # <-- on it.
I hope I could point you in the right direction.
int main