九度OJ 题目1029

只能使用红色的那句话,否则就会WA,mark一下,以后学习

#include #include #include using namespace std; struct Magic { char Name[25]; char Content[81]; }Magics[100000]; //#defineLOCAL int main() { #ifdef LOCAL freopen("data.in","r",stdin); freopen("data.out","w",stdout); #endif char cInput[150]; int index=0; while(cin.getline(cInput,150)) { if(strcmp(cInput,"@END@")==0) break; int tmpIndex=0; char *p=cInput; while(*p!=']') { Magics[index].Name[tmpIndex]=*p; p++; tmpIndex++; } Magics[index].Name[tmpIndex++]=']'; p++; Magics[index].Name[tmpIndex]='\0'; p++; tmpIndex=0; while(*p) { Magics[index].Content[tmpIndex]=*p; p++; tmpIndex++; } Magics[index].Content[tmpIndex]='\0'; index++; } int num; cin>>num; cin.ignore(); while(num>0) { num--; cin.getline(cInput,150); if(cInput[0]=='[') { bool isTrue=true; for(int i=0; i

    推荐阅读