#include <iostream>
using namespace std;
int main ()
{
time_t start,end;
// save input string
char szInput [256];
// count start
time (&start);
printf ("Please, enter your name: ");
gets (szInput);
// count stop
time (&end);
// save cost time dif = end - start
double dif = difftime (end,start);
printf ("Hi %s.\n", szInput);
printf ("You have taken %.2lf seconds to type your name.\n", dif );
system("pause");
}
2008年9月1日 星期一
計算兩者之間花了多少時間
code
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言