How would I convert this code to C++?
string[] strarr = {\"ram\",\"mohan\",\"sita\"};
foreach(string str in strarr) {
listbox.items.add(str);
}
After getting used to the var keyword in C#, I'm starting to use the auto keyword in C++11. They both determine type by inference and are useful when you just want the compiler to figure out the type for you. Here's the C++11 port of your code:
#include
#include
using namespace std;
array strarr = {"ram", "mohan", "sita"};
for(auto str: strarr) {
listbox.items.add(str);
}