Я получаю следующую ошибку при запуске кода C ++: < /p>
terminate called after throwing an instance of 'std::length_error'
what(): basic_string::_M_replace_aux
Aborted
< /code>
Вот код: < /p>
#include
using namespace std;
int main() {
int x, n;
cin >> n >> x;
int z[x * 2];
string st =
"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII";
st.resize(n);
for (int i = 0; i < x; i += 2) {
cin >> z;
}
for (int i = 0; i < x; i += 2) {
int b = z - z[i + 1];
st.replace(z, z[i + 1], b, '.');
}
cout
Что означает эта ошибка и как ее исправить? < /p>
my input: < /p>
10 3
8 10
2 5
3 6
Подробнее здесь: https://stackoverflow.com/questions/797 ... of-stdleng
Мобильная версия