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

1 Expert Approved Answer
Step: 1 Unlock

step 1 Change Compiler Dialect to ISO C11 Open Eclipse Launch Eclipse IDE and open your C project Pr... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!