Мой код, пожалуйста, проверьте по ссылке: < /p>
struct MyRowData {
int A;
int B;
int C;
};
void my_sleep(unsigned msec) {
//Sleep Function Here
}
int GetRandomInt(){
//randomize int here
}
int main() {
std::vector dataTable;
while(10000){
// Add data to the table
dataTable.push_back({GetRandomInt(), 111, 1111});
// Access and print data
for (const auto& row : dataTable) {
std::cout
< /li>
< /ol>
Что я пытаюсь сделать это: < /p>
if (GetRandomInt() == row.A) { row.B = 0 } //trying to modified row.B while random number exists from the table
< /code>
и не работает, результат < /p>
error: assignment of member ‘MyRowData::B’ in read-only object
Подробнее здесь: https://stackoverflow.com/questions/797 ... alue-exist