Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
9
Добавлен:
15.06.2014
Размер:
1.81 Кб
Скачать
// page3.cpp : implementation file
//

#include "stdafx.h"
#include "Laboratory works.h"
#include "page3.h"
#include "math.h"


// page3 dialog
/* Мой код---------------------------*/
page3 *cd3;
/* Мой код---------------------------*/


IMPLEMENT_DYNAMIC(page3, CDialog)
page3::page3(CWnd* pParent /*=NULL*/)
	: CDialog(page3::IDD, pParent)
	, m_edit(0)
{
}

page3::~page3()
{
}

void page3::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT1, m_edit);
	DDV_MinMaxInt(pDX, m_edit, 0, 999999999);
	DDX_Control(pDX, IDC_LIST1, m_list2);
	DDX_Control(pDX, IDC_EDIT1, m_input);
}


BEGIN_MESSAGE_MAP(page3, CDialog)
	ON_EN_CHANGE(IDC_EDIT1, OnEnChangeEdit1)
	ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
END_MESSAGE_MAP()


// page3 message handlers

void page3::OnEnChangeEdit1()
{
	UpdateData(TRUE);
	// TODO:  If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.

	// TODO:  Add your control notification handler code here
}

void page3::OnBnClickedButton1()
{

	int i;
char tmp[255];
char buf[20];
int nums[20];
char seps[] = " ;";
char *token;
i=0;

this->m_input.GetWindowText(tmp, 255);

token = strtok(tmp, seps);

while (token != NULL)
{
	        //this->m_list2.AddString(token);

	nums[i] = atoi(token);
     
	if ((fmod(i,2)==0)&&(fmod((nums[i]),2)==0))  {
	itoa(nums[i],buf,10); 
	i++;
	this->m_list2.AddString(buf);
	/*token = strtok(NULL, seps);*/}
	 else
	
	i++;
	//this->m_list2.AddString(buf);
	token = strtok(NULL, seps);
}



// TODO: Add your control notification handler code here
}
Соседние файлы в папке Laboratory works