我是新来的,我尝试查看旧问题,但我也是c#的新手,我发现很难解决下面的问题:
if (File.Exists(@"C:\ESC\Impostazioni.txt"))
{
TextReader lettore_file = new StreamReader(@"C:\ESC\Impostazioni.txt");
String opzioni = lettore_file.ReadLine();
int i;
for (i = 0; i < opzioni.Length; i++) <----here, indicating "i=0"
{
if (opzioni[i] == '-')
{
char[] coloregenerale = new char[i];
for (int j = 0; j < i; j++)
coloregenerale[j] = opzioni[j];
break;
Run Code Online (Sandbox Code Playgroud) 我们正在做一些关于不同排序算法的报告.它们都在工作,但是在打印合并排序的处理时间时出现错误
我写了以下代码
...BubbleSort(arr3,50000);
time(&time_now);
f = difftime(time_now,time_then);
printf("BubbleSort - tempo: %f\n",f);
time(&time_then);
printf("then: %s",ctime(&time_then));
MergeSort(arr4,0,49999);
time(&time_now);
printf("now: %s",ctime(&time_now));
f = difftime(time_now,time_then);
printf("MergeSort - tempo: %f\n",f);
Run Code Online (Sandbox Code Playgroud)
但它总是说时间= 0表示合并排序

它似乎无法获得当前时间或mergesort的处理时间真的很低(但它确实有效),提前感谢