c++ - How to make a progress bar in console? -


मैंने इस तरह से कुछ किया है:

  #include & lt; thread & gt; Int main (int argc, char * argv []) {// ... std :: थ्रेड sad_thread (मेकमेफ़ील सदा (), पैराम्स); sad_thread.join (); // ... std :: थ्रेड खुश_थ्रेड (मेकमेफ़ेल (), परम); happy_thread.join (); // ...} <  

फ़ंक्शन MakeMeFeelSad और MakeMeFeelHappy प्रत्येक के बारे में 2 मिनट के लिए चलाता है, मुझे सीएमडी में कुछ करना चाहिए यह: मुझे उदास / मुबारक हो ..... (जबकि फ़ंक्शन चल रहे हैं) - और डॉट्स हमेशा 5 तक दिखाई देते हैं, फिर वे गायब हो जाते हैं, और फिर से दिखाई देते हैं। यह बिंदु के साथ प्रगति बार की तरह है मैं यह कैसे कर सकता हूं?

ईटीए: मेरा मतलब है क्या मुझे कॉलबैक के साथ एक और धागे की आवश्यकता है?

आप कुछ ऐसा प्रयोग कर सकते हैं:

  std :: भविष्य & lt; शून्य & gt; fut = std :: async (std :: launch :: async, MakeMeFeelSad, params); Std :: cout & lt; & lt; "मुझे उदास हो रहा है"; std :: chrono :: मिलीसेकेंड अवधि (100); जबकि (fut.wait_for (span) == std :: future_status :: समय समाप्त) std :: cout & lt; & lt; '।';    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -