I'm doing a "magic square" program and I'm having trouble with a button. It is supposed to stay active for as many clicks as it takes to fill the array storing the numbers, then become disabled. The button stops working the first time i click it though, and i dont know what i'm doing wrong. could someone help me please?
heres the code for my button.
void CLab10Dlg::OnEnterDataButton()
{
// TODO: Add your control notification handler code here
GetDlgItemText(IDC_ROW_NUM, m_row_num);
GetDlgItemText(IDC_COL_NUM, m_col_num);
GetDlgItemText(IDC_DATA, m_data);
int row_num = atoi((LPCTSTR)m_row_num);
int col_num = atoi((LPCTSTR)m_col_num);
int data = atoi((LPCTSTR)m_data);
int i;
if(i < num_rows_cols)
{
magic_array[row_num-1][col_num-1] = data;
i++;
}
if(i >= num_rows_cols)
m_enter_data_button.EnableWindow(false);
}
and when I initialize "i" to zero, i get the error message:
error C2252: 'i' : pure specifier can only be specified for functions