如何在V-C ++中每秒更改输出值? [英] how to change the output values every second in V- C++?

查看:75
本文介绍了如何在V-C ++中每秒更改输出值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的输出sud ba名称(如john smith:age)和他的年龄应该自动更改(10次,startin wid 10结束wid 20),每秒钟/每分钟,&10次更改后必须停止,IN V C ++有人可以帮助我编写代码吗?


例如:约翰·史密斯:10(一秒钟/一分钟后)
约翰·史密斯:11"
|
|
|
|
|
|
约翰·史密斯:20(停止)

my output sud b a name(like john smith:age) & his age should change automatically ( 10 times,startin wid 10 ending wid 20),every second/every minute ,& after 10 changes it has to stop,IN V C++ can anybody help me with the code?


eg: john smith: 10(after one second/one minute)
john smith: 11 " "
|
|
|
|
|
|
john smith: 20 (stop)

推荐答案

如果可以允许在短时间内暂停线程的执行,则可以使用
睡眠(1000)-1秒请参见MSDN-睡眠功能 [ ^ ]
但是请勿长时间(例如1分钟)进行操作.在这里,您将需要计时器.请参见MSDN-使用计时器 [ ^ ]
If you can allow to suspend thread''s execution for short time period, then you can use
Sleep(1000) - for 1 sec. See MSDN - Sleep function[^]
But do not do it for large periods, like 1 minute. Here you will need timer. See MSDN - Using Timers[^]


这篇关于如何在V-C ++中每秒更改输出值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆