[問題] 顯示結果的問題...
#include<stdio.h>
#include<iostream>
typedef struct PersonStruct{
int id;
char nickName;
}Person;
typedef char Str20[20];
Person persons[100];
int ints[100],ints1[100];
int ints2[100]={11,22,33,44};
Str20 names[100],name1[100];
Str20 names2[100]={"33","44","55","66","77"};
int i,a,b;
Str20 str,str1,str2;
char ch[100],ch1[100];
char ch2[100]={'x','y','z','w'};
int main(int argc,char*argv[])
{
for(i=0;i<10;i++)
ch[i]='m';
bool ok=true;
for(i=0;i<10&&ok;i++){
scanf("%s",str);
if(str[1]<'m')
ok=false;
else ch[i]=str[0];
}
printf("%s %d\n",str,ch[i]);
system("PAUSE");
return 0;
}
輸入:one two three four five six seven eight nine ten
結果:three 87
ch[i]那幾行看不是很懂?@@有大大能幫小弟解惑嗎??
...(因為不知道87怎麼來的?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.126.155.60
推
07/20 00:29, , 1F
07/20 00:29, 1F
→
07/20 00:30, , 2F
07/20 00:30, 2F
推
07/20 01:26, , 3F
07/20 01:26, 3F
→
07/20 01:28, , 4F
07/20 01:28, 4F
→
07/20 01:29, , 5F
07/20 01:29, 5F
→
07/20 01:29, , 6F
07/20 01:29, 6F
→
07/20 07:17, , 7F
07/20 07:17, 7F
→
07/20 13:26, , 8F
07/20 13:26, 8F
→
07/20 13:27, , 9F
07/20 13:27, 9F
→
07/20 13:27, , 10F
07/20 13:27, 10F