Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cpp
- #include <iostream>
- #include <thread>
- void addNumbers(int a, int b) {
- int sum = a + b;
- std::cout << "Sum of " << a << " and " << b << " is: " << sum << std::endl;
- }
- void findQuotientAndRemainder(int dividend, int divisor) {
- int quotient = dividend / divisor;
- int remainder = dividend % divisor;
- std::cout << "Quotient of " << dividend << " divided by " << divisor << " is: " << quotient << std::endl;
- std::cout << "Remainder of " << dividend << " divided by " << divisor << " is: " << remainder << std::endl;
- }
- int main() {
- int num1 = 10;
- int num2 = 5;
- int dividend = 20;
- int divisor = 3;
- std::thread thread1(addNumbers, num1, num2);
- std::thread thread2(findQuotientAndRemainder, dividend, divisor);
- thread1.join();
- thread2.join();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement