字符串WERTYU

#include<stdio.h>

char *s="`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";

int main()

{

int i, c;

while ((c = getchar()) != EOF)//注意括号

{

for (i = 1; s[i] && s[i] != c; i ++)/*用s[i]当进行到字符串末尾时返回'\0'其ASCII码对应值为0.*/

printf("%d ",s[i]);

printf("\n");

if (s[i]) putchar(s[i-1]);

else putchar(c);

}

return 0;

}

你可能感兴趣的:(字符串)