小编Mat*_*att的帖子

如何在c ++中输出以毫秒为单位的时间?

#include <iostream>
#include <chrono>
#include <time.h>
#include <stdio.h>

using namespace std;
using namesapce chrono;

int main() {
  int f;
  time_t start, end;
  time (&start);
  cin >> f;
  time (&end);
  double dif = difftime (end, start);
  printf ("Elapsed time is %.2lf seconds.", dif );
}
Run Code Online (Sandbox Code Playgroud)

大家好,我目前正在进行C++任务,基本上我需要在10秒内让用户输入内容.我设法找出如何计算秒的时间,但我需要它是毫秒,因为我必须找出10秒以上的毫秒数.我不熟悉C++,并且非常感谢任何可能有助于引导我朝着正确方向前进的建议.非常感谢

c++ time clock c++11 c++-chrono

2
推荐指数
2
解决办法
593
查看次数

标签 统计

c++ ×1

c++-chrono ×1

c++11 ×1

clock ×1

time ×1