Question: Compiler and change the dialect to ISO C++11 (-std=c++11). How to I fix my eclipse to run thread? This is the code I am
Compiler and change the dialect to ISO C++11 (-std=c++11). How to I fix my eclipse to run thread?
This is the code I am trying to run:
#include
#include
int counter = 0;
void countDown()
{
while (counter > 0)
{
counter--;
std::cout << "Count Down: " << counter << std::endl;
}
}
void countUp()
{
while (counter < 20)
{
counter++;
std::cout << "Count Up: " << counter << std::endl;
}
}
int main()
{
std::thread t1(countUp);
std::thread t2(countDown);
t1.join();
t2.join();
return 0;
}
Step by Step Solution
3.54 Rating (157 Votes )
There are 3 Steps involved in it
step 1 Change Compiler Dialect to ISO C11 Open Eclipse Launch Eclipse IDE and open your C project Pr... View full answer
Get step-by-step solutions from verified subject matter experts
