#include <iostream>
#include <thread>
int calculateSum(int a, int b) {
return a + b;
}
void threadFunction(int a, int b, int& result) {
result = calculateSum(a, b);
}
int main() {
int resultFromThread;
// Define values for calculation
int value1 = 5;
int value2 = 10;
// Create a thread and pass values by reference
std::thread myThread(threadFunction, value1, value2, std::ref(resultFromThread));
// Wait for the thread to finish
myThread.join();
// Display the result from the thread
std::cout << "Result from thread: " << resultFromThread << std::endl;
return 0;
}