#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
#define BUFFER MAX_PATH
DWORD WINAPI function1(LPVOID lpParam);
void function2();
int main()
{
HANDLE hthread;
DWORD dwthreadID = 0;
cout << "Entered the main function" << endl;
hthread = CreateThread(NULL, 0, function1, NULL, 0, &dwthreadID);
function2();
return 0;
}
DWORD WINAPI function1(LPVOID lpParam)
{
double val = 1000000;
for(double v = 0; v < val; v++)
{
double num = v * 55;
cout << "Thread-1:" << " " << num << endl;
Sleep(2000);
cout << " " << endl;
}
return 0;
}
void function2()
{
double val = 2000000;
for(double v = 0; v < val; v++)
{
double num = v * 1;
cout << "Thread-2:" << " " << num << endl;
Sleep(500);
cout << " " << endl;
}
}
#include <string>
#include <windows.h>
using namespace std;
#define BUFFER MAX_PATH
DWORD WINAPI function1(LPVOID lpParam);
void function2();
int main()
{
HANDLE hthread;
DWORD dwthreadID = 0;
cout << "Entered the main function" << endl;
hthread = CreateThread(NULL, 0, function1, NULL, 0, &dwthreadID);
function2();
return 0;
}
DWORD WINAPI function1(LPVOID lpParam)
{
double val = 1000000;
for(double v = 0; v < val; v++)
{
double num = v * 55;
cout << "Thread-1:" << " " << num << endl;
Sleep(2000);
cout << " " << endl;
}
return 0;
}
void function2()
{
double val = 2000000;
for(double v = 0; v < val; v++)
{
double num = v * 1;
cout << "Thread-2:" << " " << num << endl;
Sleep(500);
cout << " " << endl;
}
}