Ok, I need to assign unique values to words. Like say for instance the word "business" has a value of $%%^&*(*
Is it possible to do by using structure variables?
Ok, I need to assign unique values to words. Like say for instance the word "business" has a value of $%%^&*(*
Is it possible to do by using structure variables?
I would also need it when users input a word for the program to search the program for these unique words.
Sure. Use a struct that holds two strings, the word and its value. It would probably be better to put these in a map instead of a specific struct, with the word as the map key and the value as the value. This would also make lookup easy.
Look into Maps, they do exactly that
http://www.cppreference.com/cppmap/index.html
just declare
it's basically a custom array, where the index, rather being of int or size_t, it is whatever is in the first type parameter of the declaration. The second would just be what the custom array holds.Code:#include <map> std::map<string, string> amap; //initializes a map from key string to value of string. amap["business"]= "$%%^&*(*"