Contents of string array not printing. Printing location insted

Hello, first post =)

I'm making a tennis stats program, simple one. and i have data about each point in 2 arrays, each 3d and each string. When i print the contents in the program itself, i get nothing, a blank space. And when i write it to a file i just get the location (I think thats what it is). Here is the code... Sorry its long

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#include "globals.h"
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <cstdlib>
#include <fstream>

using namespace std;

void MrData();
string toss;
string winnerOfToss;
string FirstServe;


string setwin[12][10][9];
string action[12][10][9];


string setwinner;
string choice;
string returner;
string pointwinner;

//Scoring

int serverscore = 0;
int returnerscore = 0;
int whosserving =1;



//-------

int gamescore;
int pointover =5;


void RecordingData(){
     system("cls");
     
     cout<<"There are/is: "<<HowManySets<<endl;
     cout<<"There are: "<<GamesPerSet<<endl;
     
     cout<<"Here we go.... the game is starting..."<<endl;
    system("cls");
      
     //cout<<"What was the sping/toss"<<endl;
     //getline(cin, toss);
     
     //cin.clear();
     //cout<<"Who won?"<<endl;
     //cout<<"1. "<<playername<<endl;
     //cout<<"2. "<<oppname<<endl;
    
     //getline(cin, winnerOfToss);
     
     //cout<<" "<<endl;
     cout<<"1. "<<playername<<endl;
     cout<<"2. "<<oppname<<endl;
    
     cout<<"Who is serving first"<<endl;
     getline(cin, FirstServe);
     
     while(FirstServe == "1"){FirstServe = playername; returner = oppname; break;}
     while(FirstServe == "2"){FirstServe = oppname; returner = playername; break;}
     
     
     cout<<" That should be it... HERE WE GO!!!"<<endl;
     //system("2");
     FormatFile();
     
     ofstream write;
     write.open("GameStats.html", ios::app);
     
     
     for(int setcount = 0; setcount < HowManySets; setcount++)
     {
              
              setwin[setcount][0][0] = setcount;
              action[setcount][0][0] = setcount;
              
              
              
              
              for(int gamecount=0; gamecount < GamesPerSet; gamecount++)
              {
                      setwin[setcount][gamecount][0] = gamecount;
                      action[setcount][gamecount][0] = gamecount;
                      
                      
                      
                      for(int pointcount = 0;pointcount < pointover ;pointcount++) // poincount might = 8
                      {
                      system("cls");
                      cout<<FirstServe<<" is servering"<<" | Score: "<<serverscore<<endl;
                      cout<<"--------------------------------------------------"<<endl;
                      cout<<"Who won the point"<<endl;  
                      cout<<"1. "<<playername<<endl;
                      cout<<"2. "<<oppname<<endl;
                      cout<<"--------------------------------------------------"<<endl;
                      cout<<"Choice: "; cin>>choice;
                      if(choice == "1"){choice = playername;}
                      if(choice == "2"){choice = oppname;}
                      
                      if(choice == FirstServe){ setwin[setcount][gamecount][pointcount] = FirstServe; pointwinner = FirstServe; serverscore += 15;}
                      if(choice != FirstServe){setwin[setcount][gamecount][pointcount] = returner; pointwinner = returner; returnerscore += 15;}
                      cout<<"--------------------------------------------------"<<endl;
                      cout<<"How did "<< pointwinner<<" win the point"<<endl;
                      cout<<"1. Ace"<<endl;
                      cout<<"2. Bad Return"<<endl;
                      cout<<"3. Forhand winner"<<endl;
                      cout<<"4. BackHand winner"<<endl;
                      cout<<"5. volly/net play"<<endl;
                      cout<<"6. overhead"<<endl;
                      cout<<"7. Opponent messup/error"<<endl;
                      cout<<" "<<endl;
                      cout<<"--------------------------------------------------"<<endl;
                      cin>>choice;
    
                      if(choice == "1"){action[setcount][gamecount][pointcount] = "Ace";}
                      if(choice == "2"){action[setcount][gamecount][pointcount] = "Bad Return";}
                      if(choice == "3"){action[setcount][gamecount][pointcount] = "Forhand winner";}
                      if(choice == "4"){action[setcount][gamecount][pointcount] = "BackHand winner";}
                      if(choice == "5"){action[setcount][gamecount][pointcount] = "volly/net play";}
                      if(choice == "6"){action[setcount][gamecount][pointcount] = "overhead";}
                      if(choice == "7"){action[setcount][gamecount][pointcount] = "Opponent messup/error";}
                      
                      
                      
                      else if(choice > "7" || choice < "1"){cout<<"Not an action"<<endl; 
                      action[setcount][gamecount][pointcount] = "Invalid Input";}
                      
                      
                      //Writing to File
                      
                      write<<"<tr><BR><th>"<<setwin[setcount][gamecount][pointcount]<<"</th>"<<endl;
                      
    
    
    
    
    
    
    
    
    
                      //--------------------------------
                      
    
                      
                      cout<<" "<<endl;
                      cout<<" "<<endl;
                      
                      
                      
                      
                      cout<<serverscore<<" -- "<<returnerscore<<endl;
                      
                      
                      //balancing the score at 40 not 45
                      
                      if(serverscore == 45){ serverscore == serverscore - 5;}
                      if(returnerscore == 45){ returnerscore == returnerscore -5;}
                      
                      
                      
                      
                      
                      //winning condition
                      if((serverscore > 45 && returnerscore <= 30) || (returnerscore > 45 && serverscore <=30))
                      {
                                      system("cls");
                      cout<<"Thats Game"<<endl;
                      cout<<"Score: "<<serverscore<<" -- "<<returnerscore<<endl;
                      whosserving++;
         
 pointcount = serverscore +15;
 
 serverscore =0;
 returnerscore = 0;
                      
                      
                      
                      
                      
                      
                      if(whosserving == 2 || whosserving == 4 || whosserving == 6 || whosserving == 8 || whosserving == 10 || whosserving == 12)
                                     {
                                        //Switch the namer, so that server is different, but function above still works  
                                          
                                        FirstServe = oppname;
                                        returner = playername;  
                                     }
                                     
                      if(whosserving == 1 || whosserving == 3 ||whosserving == 5 ||whosserving == 7 ||whosserving == 9 ||whosserving == 11 ||whosserving == 13)
                                    {
 FirstServe = playername;
 returner = oppname;
                                    
                                    }
                                      
                                      
                                      
                      }
                      
                      
                      
 system("pause");
                      
                      
      }//game point
                  
               }//game
     }//set
 string test = action[2][1][1];            
 cout<<test<<endl;
 cout<<test<<endl;           
     system("pause");
     return;
     }


And in the file, i get 0x445080 every time...

how do i get it to display just the contents. And nothing more
I didn't read all of the code but before the variable that prints out the scores try adding a *.

Like this:

cout << *my_variable << endl;
I tried that, and i just got a " no match for 'operator*' in '*setwin[setcount][gamecount][pointcount]' " error. I have never hurd of that code. Isnt that a pointer thing?

Should i be posting this in the normal windows section?
I noticed you didn't include <string>, but <cstring>. I know in visual studios when I've used string and forgot to include it, it didn't give me an error but apparently used something that doesn't act as STL's string.
Last edited on
That was it. Thanks Gumbercules!! I don't know why that would be the cause thought. Hummm

thanks for the help, i appreciate it =)
Topic archived. No new replies allowed.