Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 18, Problem 11PP
Program Plan Intro

Thread counting

Program Plan:

  • Include required header file for thread and chrono seconds.
  • Define function “countingThread” with two arguments stop value pointer and count value pointer.
    • Performs “while” loop. This loop performs upto the stop value.
      • User need to wait one second using “chrono” seconds.
      • Increment the count value pointer
      • If the count value is equal to “0”, then display count value.
  • Define main function.
    • Initializes the stop value in “bool” type.
    • Initializes the count to “1”.
    • Generate thread with counting thread function, stop value and count.
    • Initializes the number to “0”.
    • Performs “do-while” loop. This loop will execute upto, the number is less than count
      • Read the number from user.
    • Assign stop count value to “true”.
    • Wait for thread to complete by using “join” function.

Blurred answer
Students have asked these similar questions
What is Windows Server and what is the Differences between Windows Server 2019 and the Windows Operating System that people have installed on their personal computer.
solve and show the tree on paper
I need help to resolve the following activity
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT