You are on page 1of 2

Cs609

Assignment No 2

Student Name:

Arslan Ahmad

Student ID:

Bc180404161

Code:

#include <windows.h>

#include <iostream>

void VUFunc()

for (int i = 0; i<= 10; i++)

std::cout<< " Virtual University " << std::endl;

int main() {

DWORD threadId;

HANDLE hThread = CreateThread(NULL, 0,

(LPTHREAD_START_ROUTINE)VUFunc, NULL, 0, &threadId);


if (hThread == NULL)

std::cout<< " Error creating thread: " <<GetLastError() << std::endl;

return 1;

std::cout<< " Thread successfully created with ID: " <<threadId<< std::endl;

WaitForSingleObject(hThread, INFINITE);

CloseHandle(hThread);

return 0;

You might also like