// 123.cpp : Defines the entry point for the console application. #include "stdafx.h" int A, B, C, D, Y, P1, P2; unsigned __stdcall ThreadFunc( void * arg) // Функция потока { Sleep(1000); P1=A+B; printf("P1=%d\n",P1); return 0; } unsigned __stdcall ThreadFunc2( void * arg) // Функция потока { Sleep(1000); P2=C*D; printf("P2=%d\n",P2); return 0; } int main() { A=5; B=7; C=2; D=3; unsigned T1, T2; HANDLE Th1; Th1 = (HANDLE)_beginthreadex( NULL, 0, &ThreadFunc, NULL, 0,&T1); HANDLE Th2; Th2 = (HANDLE)_beginthreadex( NULL, 0, &ThreadFunc2, NULL, 0,&T2); Sleep(2000); Y=P1+P2; Sleep(3000); printf("Y=%d\n",Y); printf("Hello world!!!"); scanf(" "); return 0; }