|
|
вернуться в форумStrange(WA1) Why this gets WA1? //--------------------------------------------------------------------------- #include <iostream.h> #include <memory.h> int main() { bool mas[30][30]; for (int i=0; i<30; ++i) for (int j=0; j<30; ++j) { mas[i][j]=false; } int n; char ch,ch1,ch2; cin>>n; for (int i=0; i<n; ++i) { cin>>ch1>>ch2; mas[ch1-'a'][ch2-'a']=true; } cin>>ch; for (int i=0; i<30; ++i) { if (mas[ch-'a'][i]) { cout<<ch<<(char)(i+'a')<<endl; } } cin>>ch; return 0; } //--------------------------------------------------------------------------- Re: Strange(WA1) //what about RC/LF ? //for example //there is a text text file which contents some symbols ab ac ba //but on your hard disk drive it is look as ( in hexadimal ) "61620D0A61630D0A62661" //0D0A it is an linefeed in windows //and when you are read as cin >> ch1; //you read all characters from input file include these symbols; //instead of cin >> x >> y ( when x and y have type "char") //you must to use char s[10]; cin.getline(s,10); x = s[0]; y = s[1]; //or char s[10]; scanf("%s", s); x = s[0]; y = s[1]; or scanf("%c%c\n",&x,&y); Re: Strange(WA1) It does not work((( Can u mail me your solution to diablo_@list.ru? Re: Strange(WA1) 谁有测试数据(chinese) |
|
|