简单的c语言程序编写求助……1. 从键盘上任意输入3 个整数x、y、z,并按从大到小的顺序显示出来,请编写该程序。要求:

1个回答

  • #include

    int main(int argc, char **argv)

    {

    int x = 0, y = 0, z = 0;

    int temp = 0;

    printf("Please enter 3 integer:");

    scanf("%d,%d,%d", &x, &y, &z);

    if(x < y){

    temp = x;

    x = y;

    y = temp;

    }

    if(x < z){

    temp = x;

    x = z;

    z = temp;

    if(z > y){

    temp = y;

    y = z;

    z = temp;

    }

    }

    if(y < z){

    temp = y;

    y = z;

    z = temp;

    }

    printf("x=%d, y=%d, z=%dn", x, y, z);

    return 0;

    }

    #include

    int main(int argc, char **argv)

    {

    char ch;

    //scanf("%c", &ch);

    ch = getchar();

    switch(ch){

    case 'a':

    case 'A':

    case 'e':

    case 'E':

    case 'i':

    case 'I':

    case 'o':

    case 'O':

    case 'u':

    case 'U':

    printf("是元音字母n");

    break;

    default:

    printf("不是元音字母n");

    }

    return 0;

    }