控制台应用程序不显示任何内容

时间:2015-11-20 14:26:22

标签: c visual-studio-2013 console-application

我使用Visual Studio 2013在C中编写了一个程序,它根据三个数值计算平均时间和油漆干燥。

程序运行正常没有错误但是在调试时,控制台应用程序只显示光标闪烁。
首先我认为这只是这个程序,但后来我打开了我过去的项目,同样的事情发生时调试。

当我在另一台机器上调试时,控制台应用程序会显示程序应该打印的内容,但我的计算机却没有。这是编译器的问题吗?

#include <stdio.h>
#include <stdlib.h>

/ 代码的这个起始部分是打印出提示的地方     使用户输入程序所需的信息     打印输出结果基于输入。 /

int main(){
int numofpaints;
char paintname[30][10];
int time[3][10];
int meantime;
int var = 0;
int var2 = 0;
int hours;
int minutes;

printf("Input the number of paints you want:\n\n");
scanf("%d", &numofpaints);

/ 这个for循环是平均值的计算发生的地方     计算以确定油漆是否符合快速干燥状态。 /

for (var = 0; var < numofpaints; var++)

{
    printf("please enter the name of the paint:\n\n");
    scanf("%s", paintname[var]);

    printf("How long did %s take to dry first the first time:\n\n", paintname[var]);
    scanf("%d", &time[0][var]);

printf("How long did %s take to dry for the second time:\n\n", paintname[var]);
    scanf("%d", &time[1][var]);

    printf("How did it take for %s to dry for the third time:\n\n", paintname[var]);
    scanf("%d", &time[2][var]);
}



for (var2 = 0; var2 < numofpaints; var2++)
{
    meantime = (time[0][var2] + time[1][var2] + time[2][var2]) / 3;
    hours = meantime / 60;
    minutes = meantime % 60;

/ 这些if语句用于根据所做的计算打印输出结果     使用用户通过键盘输入的值。例如,如果值     输入的用户输入5然后将使用适当的语句     将打印“5小时”而不是“5小时0分钟”。 /

if (hours > 1 && minutes == 0)
    {
        printf("\n%s finished drying in %d hours. ", paintname[var2], hours);
    }
    else if (hours > 1 && minutes > 1)
    {
        printf("\n%s finished drying in %d hours and %d minutes. ", paintname[var2], hours, minutes);
    }
    else if (hours > 1 && minutes == 1)
    {
        printf("\n%s finished drying in %d hours and %d minute. ", paintname[var2], hours, minutes);
    }
    else if (hours == 0 && minutes != 1)
    {
        printf("\n%s finished drying in %d minutes. ", paintname[var2], minutes);
    }
    else if (hours == 1 && minutes == 1)
    {
        printf("\n%s finished drying in 1 hour and 1 minute. ", paintname[var2]);
    }
    else if (hours == 1 && minutes > 1)
    {
        printf("\n%s finished drying in 1 hour and %d minutes. ", paintname[var2], minutes);
    }
    else if (hours == 0 && minutes == 1)
    {
        printf("\n%s finished drying in %d minute. ", paintname[var2], minutes);
    }
    else if (hours == 1 && minutes == 0)
    {
        printf("\n%s finished drying in an hour. ", paintname[var2]);
    }

/ 这些if语句可以确定油漆是否符合即时,快速或快速的条件。         第一个如果说明是否计算了3个输入的平均时间         值小于或等于1小时/ 60然后它适合即时油漆类别。所以每一个         在3个陈述中,将确定油漆是否适合即时,快速或快速。 /         如果(同时<360)             printf(“这意味着%s符合条件”,paintname [var2]);         其他

        printf("This means %s did not qualify.\n\n\n", paintname[var2]);

if (meantime <= 60)
    {
        printf("and\nit'll fit into the category of instant paint.\n\n\n", paintname[var2]);
    }
    else if (meantime <= 119){
        printf("and\nit'll fit into the category of fast paint.\n\n\n", paintname[var2]);
    }
    else if (meantime <= 359){
        printf("and\nit'll fit into the category of quick paint.\n\n\n", paintname[var2]);
    }
        else{

        }


}

}

0 个答案:

没有答案