trong C# hàm đến thời gian chạy thuật toán nào đó thì minh phải viết thế nào vậy?anh em nào biết chỉ giúp mình nhé.
code ben C++ thế này nè:
Visual C# Code:
{ long temp; clock_t start,end; double tg; //bat dau bam thoi gian chay thuat toan start=clock(); { //doi cho a[j] va a[j-1] temp= a[j]; a[j]=a[j-1]; a[j-1]=temp; } end=clock(); FILE *f; f=fopen("KetQuaNotBot.out","wt"); fprintf(f,"Thoi gian chay thuat toan Noi Bot: %2.15lf\n",tg); fprintf(f,"%ld\n",a[j]); cout<<"\n Ket qua da duoc ghi vao file"; fclose(f); }
Không biết ghi gì luôn ...
Visual C# Code:
DateTime start, stop; start = DateTime.Now; // // ...Action Code end = DateTime.Now; DateTime timer = end - start; //Console.WriteLine(timer.Seconds);
None!
Cảm ơn các bạn nhé,minh sẽ thử có gì PM sau.
OK.thank cac ban nhe
Console.WriteLine(timer.TotalSeconds);