global variable

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
char **TT; 
TT[0][0] = "adducts"; TT[0][1] = "adduct";
TT[1][0] = "closes"; TT[1][1] = "close";
TT[2][0] = "compresses"; TT[2][1] = "compress";
TT[3][0] = "depresses"; TT[3][1] = "depress";
TT[4][0] = "draws"; TT[4][1] = "draw"; 
TT[5][0] = "elevates"; TT[5][1] = "elevate";
TT[6][0] = "everts"; TT[6][1] = "evert"; 
TT[7][0] = "extends"; TT[7][1] = "extend"
TT[8][0] = "flexes"; TT[8][1] = "flex"
TT[9][0] = "lowers"; TT[9][1] = "lower"
TT[10][0] = "opens"; TT[10]1] = "open"
TT[11][0] = "protracts"; TT[11][1] = "protract"
TT[12][0] = "pulls"; TT[12][1] = "pull" 
TT[13][0] = "raises"; TT[13][1] = "raise"
TT[14][0] = "rotates"; TT[14][1] = "rotate"
TT[15][0] = "stabilizes"; TT[15][1] = "stabilize"


How to declare this in my .h file? What do I put?
Last edited on
You can not place this code in a header file. Header files can contain only declarations or definitions.
That to place a similar code in a header you can do for example the following way

1
2
3
4
const char * TT[] = { "adducts", "adduct",
                       "closes";     "close",
/* other string literals */
                       "stabilizes", "stabilize" };
Last edited on
Put this in the header file
extern const char *TT[16][2];

and the following in a soruce file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const char *TT[16][2] = 
{
	{"adducts", "adduct"},
	{"closes", "close"},
	{"compresses", "compress"},
	{"depresses", "depress"},
	{"draws", "draw"},
	{"elevates", "elevate"},
	{"everts", "evert"},
	{"extends", "extend"},
	{"flexes", "flex"},
	{"lowers", "lower"},
	{"opens", "open"},
	{"protracts", "protract"},
	{"pulls", "pull"},
	{"raises", "raise"},
	{"rotates", "rotate"},
	{"stabilizes", "stabilize"},
};
Thanks so much :] Please Help!!!!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
 if (verb == "A") { //if user selects A
                cout << "What is the value for that type you want to find?" << endl; 
                //askes user for value of action
                cin.getline (LINE, 236);// gets line from user for the action to find   
                value = LINE;
             
            cout << "The following bones are involved:" << endl;
            for(size_t i = 0; i < csvData.size(); i++) {
            //for loop to search for action
              if (csvData[i][4].find(value) != string::npos || value.find(csvData[i][4]) != string::npos) {//search in action, column 4
                     cout << csvData[i][0] << endl;//return bone, column 0 
              }     
        }
 }


Now, I want to add this to this function. So, I want to read my column 5 of my .csv file. It is like "flexes arm" but I have to allow user to enter "flex arm", how to do this?
Last edited on
This reads like "flexes arm," so now how to change this using my global variable to read "flex arm."
Anyone? Please Help!!!! How would I do this? :
take the first word from your column ([i][4]), and lookup the alternate word and compare the alternate word with Value to consider that row a match.
Last edited on
I really need help!!!! Someone help!!!!
Someone Help!!!!!!!!!!!!!!!!!!!!!
How to compare?
(*TT[16][2]> *TT[16][1])??
Someone???????????????????????Anyone??????????????????????
What is *TT[16][2]? If you mean the definition showed by Peter87 then you can not access *TT[16][2] because available indexes are in the range [0, 15] and [0, 1]
Topic archived. No new replies allowed.