小编Sco*_*ers的帖子

C编程中Short,long和Long long int的区别?

我正在自己在线学习C编程,这样我就可以为2016年冬天的大学做好准备.我正在学习数据类型.我不明白之间的区别:

short
long
long long integers in C programming
Run Code Online (Sandbox Code Playgroud)

我在线查看,但我仍然对如何使用这些以及何时使用感到困惑.谢谢.

c

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

while循环在C程序中多次重复一系列任务

我正在编写一个C程序来重复一系列指定时间的问题.我要求用户输入他们想要的尝试次数,然后我根据他们的数量运行以下循环,但问题是循环不断重复.它不会停止在指定的尝试次数.这是代码:

#include <stdio.h>
int main(void){

    int num1,num2,high,low,average,subtotal,total_aver;

    printf("Enter number of tries you want:");
    scanf("%d", &num1);



    while (num1 < num1 + 1) {

            printf("Try number: ");
            scanf("%d", &num2);

            printf("Enter high ");
            scanf("%d", &high);

            printf("Enter low ");
            scanf("%d", &low);

            subtotal = high + low;
            total_aver = subtotal / 2;

            printf("Average temperature is: %d", total_aver);

    }

}
Run Code Online (Sandbox Code Playgroud)

如果用户输入3尝试次数,那么程序应该在循环内部询问这些问题三次,但它会不断重复而不会结束.

c loops

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

标签 统计

c ×2

loops ×1