![]() |
|
|
Регистрация Восстановить пароль |
Регистрация | Задать вопрос |
Заплачу за решение |
Новые сообщения |
Сообщения за день |
Расширенный поиск |
Правила |
Всё прочитано |
![]() |
|
Опции темы | Поиск в этой теме |
![]() |
#1 |
Новичок
Джуниор
Регистрация: 27.11.2007
Сообщений: 2
|
![]()
Товарищи, помогите студенту ставшему пред сессией!
Программа на половину сделана, однако нужно доделать. Не знаем как (делаем вдвоём). Условие(одно из двух, точно не знаю): 1.Разбиение исходного множества на попарно непересекающиеся множества. 2.Построение множества подмножеств заданного множества, содержащих по n элементов. Исходный код (первая половина): // lab2.cpp : Defines the entry point for the application. // #include "stdafx.h" #include "resource.h" #include "windows.h" #include "stdio.h" #include "string.h" #define MAX_LOADSTRING 100 // Global Variables: int sch; HINSTANCE hInst; // current instance TCHAR szTitle[MAX_LOADSTRING]; // The title bar text TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text // Foward declarations of functions included in this code module: LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM); int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { return DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, 0, (DLGPROC)About);; } LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; HWND hwndEdit1,hwndEdit2,hwndEdit3,hwndE dit4,hwndEdit5; int i0,i1; int a,a1,u,o,l,p,a2,t,f,r,kol,kol1,t1,g ,g1; int i,k,j,j1,sc1,sc2; char str[255],str1[255],str2[255],chr[255]; j=p=k=u=o=l=f=kol=kol1=t1=sc1=sc2=0 ; i0=i1=1; switch (message) { case WM_INITDIALOG: hwndEdit1 = GetDlgItem(hDlg,IDC_EDIT1); hwndEdit2 = GetDlgItem(hDlg,IDC_EDIT2); hwndEdit3 = GetDlgItem(hDlg,IDC_EDIT3); SetWindowText(hwndEdit1,"{}"); SetWindowText(hwndEdit2,"{}"); SetWindowText(hwndEdit3,"{}"); return TRUE; case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); switch (wmId) { case IDC_BUTTON1: hwndEdit1 = GetDlgItem(hDlg,IDC_EDIT1); hwndEdit2 = GetDlgItem(hDlg,IDC_EDIT2); hwndEdit3 = GetDlgItem(hDlg,IDC_EDIT3); hwndEdit4 = GetDlgItem(hDlg,IDC_EDIT4); hwndEdit5 = GetDlgItem(hDlg,IDC_EDIT5); a=GetWindowText(hwndEdit1,str,255); a1=GetWindowText(hwndEdit2,str1,255 ); a2=GetWindowText(hwndEdit3,str2,255 ); r=0; i=0; if ((str1[i]!='{')&&(str1[a1]!='}')) r=1; i++; while (i<a1-1) { if (str1[i]=='{') { if ((str1[i-1]!=',')&&(str1[i-1]!='{')) r=1; else if (str1[i+1]==',') r=1; sc1++; } if (str1[i]=='}') { if (str1[i-1]==',') r=1; else if ((str1[i+1]!=',')&&(str1[i+1]!='}')) r=1; sc2++; } if (str1[i]==',') { if (((str1[i+1]==',')||(str1[i+1]=='}'))||(str1[i-1]=='{')) r=1; } i++; } if ((sc1!=sc2)||(r==1)) { MessageBox(NULL,"Not correct entring text in Started_Mas","",MB_OK); break; } sc1=sc2=0; r=0; i=0; if ((str[i]!='{')&&(str[a]!='}')) r=1; i++; while (i<a-1) { if (str[i]=='{') { if ((str[i-1]!=',')&&(str[i-1]!='{')) r=1; else if (str[i+1]==',') r=1; sc1++; } if (str[i]=='}') { if (str[i-1]==',') r=1; else if ((str[i+1]!=',')&&(str[i+1]!='}')) r=1; sc2++; } if (str[i]==',') { if (((str[i+1]==',')||(str[i+1]=='}'))||(str[i-1]=='{')) r=1; } i++; } if ((sc1!=sc2)||(r==1)) { MessageBox(NULL,"Not correct entring text of Massive#1","",MB_OK); break; } sc1=sc2=0; r=0; i=0; if ((str2[i]!='{')&&(str2[a2]!='}')) r=1; i++; while (i<a2-1) { if (str2[i]=='{') { if ((str2[i-1]!=',')&&(str2[i-1]!='{')) r=1; else if (str2[i+1]==',') r=1; sc1++; } if (str2[i]=='}') { if (str2[i-1]==',') r=1; else if ((str2[i+1]!=',')&&(str2[i+1]!='}')) r=1; sc2++; } if (str2[i]==',') { if (((str2[i+1]==',')||(str2[i+1]=='}'))||(str2[i-1]=='{')) r=1; } i++; } |
![]() |
![]() |
![]() |
#2 |
Новичок
Джуниор
Регистрация: 27.11.2007
Сообщений: 2
|
![]()
Вторая чась:
if ((sc1!=sc2)||(r==1)) { MessageBox(NULL,"Not correct entring text of Massive#2","",MB_OK); break; } str[a-1]=','; str1[a1-1]=','; str2[a2-1]=','; i=1; g=-1; g1=-2; while (i<a-1) { if (str[i]=='{') { p++; t=i; while (g!=g1) { if (str[i]=='{') { kol++; g=kol; } if (str[i]=='}') { kol1++; g1=kol1; t1=i; } i++; } i=t; while (i<=t1) { chr[u]=str[i]; u++; i++; } } else { while (str[i]!=',') { chr[u]=str[i]; u++; i++; } p++; } j=1; kol=kol1=0; f=u; u=o=0; g=-1; g1=-2; while (j<a1-1) { if (str1[j]=='{') { t=j; while (g!=g1) { if (str1[j]=='{') { kol++; g=kol; } if (str1[j]=='}') { kol1++; g1=kol1; t1=j; } j++; } j=t; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!for (j=t;j<=t1;j++) { for (j1=0;j1<=f;j1++) { if (str1[j]==chr[j1]) { o++; j1=f; } } } if (o==u) { l++; j=a1-1; } } else { while (str1[j]!=',') { if (str1[j]==chr[u]) o++; u++; j++; } if ((o==u)&&(o==f)) { l++; j=a1-1; } } j++; u=o=0; } i++; } if (l==p) SetWindowText(hwndEdit4,"Yes"); else SetWindowText(hwndEdit4,"No"); case IDOK: return TRUE; case IDCANCEL: EndDialog(hDlg, LOWORD(wParam)); return TRUE; } } return FALSE; } СДЕЛАЙТЕ КОММЕНТАРИИ ПОЖАЛУСТА, ЕСЛИ МОЖНО |
![]() |
![]() |
![]() |
![]() |
||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
Помогите решить задачу на множества (Паскаль) | mpegable | Помощь студентам | 3 | 17.02.2015 00:15 |
помогите до решать задачу на Множества | pelsh | Помощь студентам | 2 | 05.01.2008 16:02 |
множества | xxxPascalxxx | Помощь студентам | 1 | 27.12.2007 21:54 |