高手:我想把电脑随机数实时显示在编辑框中 (我已经在编辑框中,定义了一个浮点型变量 m_max_z)
for(int i=0; i<data; i++) //
{
p[i] = rand() % (int)(Max)+1; // 产生0-100的随机数
m_max_z=p[i];
}
我这个循环在在Mychild绘图函数中,我想让p[i];绘图,m_max_z在编辑框中显示数据程序报错
C:\Documents and Settings\000Mychild.cpp(412) : error C2065: 'm_max_z' : undeclared identifier我想:可能是Mychild是CWnd派生的类,对话框类为:MyDlg现在不知怎么改了
for(int i=0; i<data; i++) //
{
p[i] = rand() % (int)(Max)+1; // 产生0-100的随机数
m_max_z=p[i];
}
我这个循环在在Mychild绘图函数中,我想让p[i];绘图,m_max_z在编辑框中显示数据程序报错
C:\Documents and Settings\000Mychild.cpp(412) : error C2065: 'm_max_z' : undeclared identifier我想:可能是Mychild是CWnd派生的类,对话框类为:MyDlg现在不知怎么改了
你看看这篇文章会不会对你有帮助
http://blog.csdn.net/xianglitian/article/details/6729851
假设你的m_max_z变量是public的直接
(AfxGetApp()->GetMainWnd()).m_max_z=p[i];
你的m_max_z变量是private、protected的
在MyDlg添加一方法,SetValue(double a);
然后
(AfxGetApp()->GetMainWnd()).SetValue(p[i]);
设置完 后 UpdateData();
F:\VC\双绘图区 \MyLine.cpp(438) : error C2228: left of '.m_max_z' must have class/struct/union type我这里的m_max_z是浮点式变量,程序怎么要求是类呢