注册 登录
编程论坛 C语言论坛

大佬们看下 为什么从子函数返回main函数之后就不会执行if了呢?而是直接return了。。

热心市民小白 发布于 2019-07-24 00:02, 1296 次点击
现在程序在同学电脑上(VS2013,我的电脑安装的VS2019)就可以完美运行,在我的电脑上就不能运行,当从子函数返回后就不执行if了。。。。
2 回复
#2
热心市民小白2019-07-24 00:03
#include<stdio.h>
const int ceiling = 32767;
const int lower = 0;
int xxdsinput()
{
    int _temp;
    float temp,result;
    printf("now it is outputchange\n");
    again:
    printf("please input 0--32767\n");
    scanf_s("%d", &_temp);
    if (_temp > ceiling)
    {
        printf("input error HOL=32767\n");
        printf("return home\n\n");
        return 0;
    }
    temp = _temp;
    result =100/(ceiling/temp);
    printf("result=%%%.2f\n\n", result);
    goto again;
    return 0;
}
int xxdsoutput()
{
    int _result;
    float temp=0, result=0;
    printf("now it is inputchange\n");
    again:
    printf("please input 0%%--100%%\n");
    scanf_s("%f", &temp);
    if (temp > 100)
    {
        printf("input error HOL=100\n");
        printf("return home\n\n");
        return 0;
    }
    result = ceiling / (100 / temp);
    _result = result;
    printf("result=%d\n\n", _result);
    goto again;
    return 0;
}
int main()
{
    char choose,c;
    again:
    printf("please choose \n");
    printf("inpur=A  output=B\n");
    choose = getchar();
    c=getchar();
    if ((choose == 'a') || (choose == 'A'))
    {
        xxdsoutput();
        goto again;
    }
    else if ((choose == 'b') || (choose == 'B'))
    {
        xxdsinput();
        goto again;
    }
    return 0;
}
#3
rjsp2019-07-24 13:28
听不懂,
我猜,
你还是在 if ((choose == 'a') || (choose == 'A')) 前加一句 printf( "0x%hhX\n", choose ); 进行调试吧
1