小编max*_*esa的帖子

对象引用未设置为对象EDIT的实例

我是新来的,我尝试查看旧问题,但我也是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)

c# nullreferenceexception

1
推荐指数
1
解决办法
88
查看次数

时间(*time_t)没有得到当前时间(作业)

我们正在做一些关于不同排序算法的报告.它们都在工作,但是在打印合并排序的处理时间时出现错误

我写了以下代码

...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的处理时间真的很低(但它确实有效),提前感谢

c c++

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

标签 统计

c ×1

c# ×1

c++ ×1

nullreferenceexception ×1