I have this code:
ofstream Out("Test.ini", ios::out | ios::app);
//head
#include<windows.h>
#include<iostream>
#include<fstream>
#include<string>
#include<ctime>
#include<string>
#include<sstream>
//code
string pismena[9][49]
stringstream stri;
stringstream stri1;
stringstream stri2;
ConNum = rand() % 900 + 100;
for(int o = 0; o <= 42; o++)
{
Random1 = rand() % 500 + 1;
Random2 = rand() % 1000 + 77;
Random10 = ConNum + Random1;
Random20 = ConNum2 + Random2;
znaky[o] = rand() % 26 + 65;
cout << endl << Random10 << znaky[o] << Random20 << " = " << o << endl;
Out << Random10;
Out << znaky[o];
if(o <= 41)
{
Out << Random20 << " ";
}
else
{
Out << Random20;
}
cout << "0";
stri << Random10;
st1 = stri.str();
stri.str("");
Sleep(200);
cout << "1";
stri1 << znaky[o];
st2 = stri1.str();
stri1.str("");
Sleep(200);
cout << "2";
stri2 << Random20;
st3 = stri2.str();
stri2.str("");
Sleep(200);
cout << "3";
pismena[9][o] = st1 + st2 + st3;
cout << "4" << endl;
cout << pismena[9][o] << endl;
st1 = "";
st2 = "";
st3 = "";
Sleep(2000);
}
Out.close();
Between step 3 and 4, when the error occurs, if o = 3.
Error:
There is a problem with the application Code.exe and therefore needs to close. We apologize for any inconvenience.
Details:
AppName: code.exe AppVer: 0.0.0.0 ModName: code.exe
ModVer: 0.0.0.0 Offset: 00009749
I use win32.
I don't know continue.
Last edited on
So I have a larger index 9 to 10?
Arrays start from index 0. If you have an array of 9, it's from 0-8.
You have an array string pismena[9][49]
And you're trying to access pismena[9]
which doesnt exist, because the last one is pismena[8]
Have I understand it .. thank you very much.