mfc矩阵运算,函数无法获得参数
void CMyDlg::OnButton1() {
CString s1,s2,c,x1,x2;
int na,nb,i,j;
CUIntArray m,n,mn;
GetDlgItemText(IDC_EDIT1,s1);
GetDlgItemText(IDC_EDIT2,s2);
for(i=0;i<CEdit::GetLineCount(s1);i++)
{
x1=x1+CEdit::GetLine(i,s1)+" ";
}
for(j=0;j<CEdit::GetLineCount(s2);j++)
{
x2=x2+CEdit::GetLine(j,s2)+" ";
}
char *ch1=strtok(x1," ");
while(ch1!=NULL)
{
m.Add(atoi(ch1));
ch1=(NULL," ");
}
char *ch2=strtok(x2," ");
while(ch2!=NULL)
{
n.Add(atoi(ch2));
ch2=(NULL," ");
}
for(i=0;i<m.GetSize();i++)
{
mn[i]=m[i]+n[i];
c=c+itoa(mn[i])+" ";
if(i%CEdit::GetLineCount(s1)==0) c=c+"\r\n";
}
SetDlgItemText(IDC_EDIT3,c);
}
Compiling...
矩阵计算器Dlg.cpp
C:\Users\Administrator\Desktop\自学c++\矩阵计算器\矩阵计算器Dlg.cpp(183) : error C2660: 'GetLineCount' : function does not take 1 parameters
C:\Users\Administrator\Desktop\自学c++\矩阵计算器\矩阵计算器Dlg.cpp(185) : error C2665: 'GetLine' : none of the 2 overloads can convert parameter 2 from type 'class CString'
C:\Users\Administrator\Desktop\自学c++\矩阵计算器\矩阵计算器Dlg.cpp(187) : error C2660: 'GetLineCount' : function does not take 1 parameters
C:\Users\Administrator\Desktop\自学c++\矩阵计算器\矩阵计算器Dlg.cpp(189) : error C2665: 'GetLine' : none of the 2 overloads can convert parameter 2 from type 'class CString'
C:\Users\Administrator\Desktop\自学c++\矩阵计算器\矩阵计算器Dlg.cpp(191) : error C2664: 'strtok' : cannot convert parameter 1 from 'class CString' to 'char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\Administrator\Desktop\自学c++\矩阵计算器\矩阵计算器Dlg.cpp(197) : error C2664: 'strtok' : cannot convert parameter 1 from 'class CString' to 'char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\Administrator\Desktop\自学c++\矩阵计算器\矩阵计算器Dlg.cpp(206) : error C2660: 'itoa' : function does not take 1 parameters
C:\Users\Administrator\Desktop\自学c++\矩阵计算器\矩阵计算器Dlg.cpp(207) : error C2660: 'GetLineCount' : function does not take 1 parameters
执行 cl.exe 时出错.
矩阵计算器.exe - 1 error(s), 0 warning(s)