标签:des style blog color os io for div
1 #include<iostream> 2 #include<cstring> 3 using namespace std; 4 5 class Alphabet 6 { 7 public: 8 char sign[30],power[100]; 9 Alphabet *next; 10 }; 11 class Process 12 { 13 public: 14 Process() 15 { 16 head=NULL; 17 p=NULL; 18 record=NULL; 19 } 20 void Input() 21 { 22 char sh[150]; 23 char s1[30],s2[100]; 24 while(gets(sh)&&(strcmp(sh,"@END@")!=0)) 25 { 26 char *ch=strchr(sh,‘]‘); 27 ch+=2; 28 int i; 29 for( i=0;sh[i]!=‘]‘;i++) 30 { 31 s1[i]=sh[i]; 32 } 33 s1[i]=sh[i]; 34 s1[i+1]=0; 35 Insert(s1,ch); 36 } 37 scanf("%d",&num);getchar(); 38 for(int i=1;i<=num;i++) 39 { 40 char s[100]; 41 gets(s); 42 if(s[0]==‘[‘) 43 SearchSign(s); 44 else 45 SearchPower(s); 46 } 47 } 48 void SearchSign(char *s) 49 { 50 p=head; 51 while(p!=NULL) 52 { 53 if(strcmp(p->sign,s)==0) 54 { 55 printf("%s\n",p->power); 56 return; 57 } 58 p=p->next; 59 } 60 printf("what?\n"); 61 } 62 void SearchPower(char *s) 63 { 64 p=head; 65 while(p!=NULL) 66 { 67 if(strcmp(p->power,s)==0) 68 { 69 int n=strlen(p->sign); 70 for(int i=1;i<n-1;i++) 71 { 72 printf("%c",p->sign[i]); 73 } 74 printf("\n"); 75 return; 76 } 77 p=p->next; 78 } 79 printf("what?\n"); 80 } 81 void Insert(char *s1,char *s2) 82 { 83 p=new Alphabet; 84 strcpy(p->sign,s1); 85 strcpy(p->power,s2); 86 if(head==NULL) 87 head=p; 88 else 89 record->next=p; 90 record=p; 91 record->next=NULL; 92 } 93 void OUTPUTALL() 94 { 95 p=head; 96 while(p!=NULL) 97 { 98 cout<<p->sign<<" "<<p->power<<endl; 99 p=p->next; 100 } 101 //printf("what?\n"); 102 } 103 private: 104 int num; 105 Alphabet *head,*p,*record; 106 }; 107 int main() 108 { 109 while(1) 110 { 111 Process p1; 112 p1.Input(); 113 } 114 return 0; 115 }
[expelliarmus] the disarming charm
[rictusempra] send a jet of silver light to hit the enemy
[tarantallegra] control the movement of one‘s legs
[serpensortia] shoot a snake out of the end of one‘s wand
[lumos] light the wand
[obliviate] the memory charm
[expecto patronum] send a Patronus to the dementors
[accio] the summoning charm
@END@
8
[lumos]
the summoning charm
[arha]
take me to the sky
the memory charm
send a Patronus to the dementors
[tarantallegra]
send a jet of silver light to hit the enemy
标签:des style blog color os io for div
原文地址:http://www.cnblogs.com/sytu/p/3871580.html