Don't use using namespace std
. Its considered bad practice.
See Why is "using namespace std" considered bad practice?
Why pass std::string by pointer? In C++ we have references &. They safe you the burden of dereference the pointers.
Dont use c-style arrays like
string fruits[] = {"Apple", "Banana", "Orange", "Grapes", "Lemon"};
In c++ you can use std::vector or std::array(if the size is fixed) for the task:
std::vector<std::string> fruits = {"Apple", "Banana", "Orange", "Grapes", "Lemon"};
Whats the whole purpose of the structure? You could just use a std::vector<std::pairstd::string,int> and use std::find and std::sort to accomplish what you want to archieve with youre data structure.
Don't use using namespace std
. Its considered bad practice.
Don't use using namespace std
. Its considered bad practice.
See Why is "using namespace std" considered bad practice?
Why pass std::string by pointer? In C++ we have references &. They safe you the burden of dereference the pointers.
Dont use c-style arrays like
string fruits[] = {"Apple", "Banana", "Orange", "Grapes", "Lemon"};
In c++ you can use std::vector or std::array(if the size is fixed) for the task:
std::vector<std::string> fruits = {"Apple", "Banana", "Orange", "Grapes", "Lemon"};
Whats the whole purpose of the structure? You could just use a std::vector<std::pairstd::string,int> and use std::find and std::sort to accomplish what you want to archieve with youre data structure.
DontDon't use using namespace std
. Its considered bad practice.
Dont use using namespace std
. Its considered bad practice. See https://www.google.de/url?sa=t&source=web&rct=j&url=https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice&ved=2ahUKEwji0KCo1JDdAhXMKewKHZX-AxQQFjAFegQIBhAB&usg=AOvVaw3k3HuVD-pzfPiMJTh1OKtq
Don't use using namespace std
. Its considered bad practice.
Dont use using namespace std
. Its considered bad practice. See https://www.google.de/url?sa=t&source=web&rct=j&url=https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice&ved=2ahUKEwji0KCo1JDdAhXMKewKHZX-AxQQFjAFegQIBhAB&usg=AOvVaw3k3HuVD-pzfPiMJTh1OKtq