小编Sou*_*nce的帖子

使用if_else从3个数字中获得第2大

我对C编程很陌生,最近我遇到了一个从3个数字中找到第2大数字的问题.我尝试使用if ... else,但总是给出最小的数字作为输出.我在这段代码中犯的逻辑错误是什么?

#include<stdio.h>

int main() {
    int a;
    int b;
    int c;
    a=10;
    b=30;
    c=7;
    if(a>b) {
        if(a>c) {
            if(b>c)
                printf("2nd largest is %d",c);
            else
                printf("2nd largest is %d",b);
        }
    } else

    {
        if(b>c) {
            if(c>a)
                printf("2nd largest is %d",a);
            else
                printf("2nd largest is %d",c);
        } else
            printf("2nd largest is %d",b);
    }
}
Run Code Online (Sandbox Code Playgroud)

c

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

如何向其他 Google 用户授予访问权限并测试我的 Dialogflow 应用程序?

如何让不同的谷歌用户使用我的dialogflow应用程序?我尝试添加用户的电子邮件 ID(电子邮件在 Google Cloud Platform Console 的 IAM 下添加为 PROJECT Viewer)。但是,当我在 Google Assistant 上测试该用户并说“与 myAppName 交谈”时,Google 无法识别该用户尝试访问dialogflow应用程序。

实现这一目标的正确方法是什么?

google-account google-assistant-sdk dialogflow-es

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