#include <iostream>
using namespace std;
int numbers[] {2, 3, 5, 7, 11, 13};
string str = "";
for (int n : numbers) {
if (n > 10) {
break;
}
str += (str == "" ? "" : "-") + to_string(n);
}
//str is "2-3-5-7"
cout << "str is '" << str << "'";