虽是小白问题,但请顺手解决。。。
1楼 #include<stdio.h>
main()
{
int a,b,c;
int d,e;
printf("Please input three char:");
scanf("%c%c%c",&a,&b,&c);
d=a-b;
e=b-c;
if((d=-1)&&(e=-1))
{
printf("The letters are adjacent with each other.\n");
}
else
{
printf("The letters are not adjacent with each other.\n");
}
system("pause");
}
目标是判断字符相邻 如abc而非aBc
想用asc码相减得出,
但不知如何在存入三个字符后转化为asc码。。。
目前不管如何都输出"The letters are adjacent with each other."
谢谢大家