0

ONE variable , MANY values ?

is it possible to assign many values to one variable ,for example country = America,Algeria,...,Zimbabwe to assign the names of all countries in the world to one variable named country I tried but cannot make it work how to I achieve this using C++?

10th Oct 2018, 3:18 AM
Joakim Bongani Munyanyi
Joakim Bongani Munyanyi - avatar
2 Réponses
+ 8
Try making an array of strings. https://www.sololearn.com/learn/CPlusPlus/1625/
10th Oct 2018, 3:28 AM
Hoàng Nguyễn Văn
Hoàng Nguyễn Văn - avatar
+ 6
Hoàng Nguyễn Văn has pointed you in the correct direction. This is just an example of his suggestion: std::string countries = {"America", "Algeria"};
10th Oct 2018, 6:54 AM
Hatsy Rei
Hatsy Rei - avatar