这是我的代码。每当我将SAR输入输入时,程序不会出于某种原因打印任何内容。它不应该转到第一个if然后第二个如果在那之下并打印出“A R S”?
#include<stdio.h>
void orders_char(int c1, int c2, int c3);
void orders_char(int c1, int c2, int c3)
{
if(c1 < c2)
if(c2 < c3)
printf("Ordered characters are: %c %c %c", c1, c2, c3);
else if(c3 < c2 && c1 < c3)
printf("Ordered characters are: %c %c %c", c1, c3, c2);
else if(c2 < c1)
if(c1 < c3)
printf("Ordered characters are: %c %c %c", c2, c1, c3);
else if(c3 < c1 && c3 < c2)
printf("Ordered characters are: %c %c %c", c3, c2, c1);
else if (c3 < c1 && c3 > c2)
printf("Ordered characters are: %c %c %c", c2, c3, c1);
else if(c1 > c3)
if (c3 < c2 && c2 > c1)
printf("Ordered characters are: %c %c %c", c3, c1, c2);
else if(c3 > c2 && c2 < c1)
printf("Ordered characters are: %c %c %c", c2, c3, c1);
else if( c3 < c2 && c1 > c2)
printf("Ordered characters are: %c %c %c", c3, c2, c1);
return;
}
int main(void)
{
char c1, c2 ,c3;
int i = 65;
printf("Please enter 3 capital letters with no spaces: \n");
scanf("%c%c%c", &c1, &c2, &c3);
orders_char(c1, c2, c3);
return 0;
}