|
|
back to boardnima xato #include <iostream> #include <string> using namespace std; int main () { string s[2002]; unsigned int n; bool t=false; bool t1=false; bool t2=false; bool t3=false; cin>>n; for( int i=1;i<=2*n;i++) { cin>>s[i]; if("Slytherin"==s[i]) t=true; if("Hufflepuff"==s[i]) t2=true; if("Gryffindor"==s[i]) t1=true; if("Ravenclaw"==s[i]) t1=true; } if(t) { cout<<"Slytherin:"<<endl; for(int i=1;i<=n;i++) if("Slytherin"==s[2*i]) cout<<s[2*i-1]<<endl; cout<<endl; } if(t2) { cout<<"Hufflepuff:"<<endl; for(int i=1;i<=n;i++) { if("Hufflepuff"==s[2*i]) cout<<s[2*i-1]<<endl; } cout<<endl; } if(t1) { cout<<"Gryffindor:"<<endl; for(int i=1;i<=n;i++) if("Gryffindor"==s[2*i]) cout<<s[2*i-1]<<endl; } if(t) { cout<<"Ravenclaw:"<<endl; for(int i=1;i<=n;i++) if("Ravenclaw"==s[2*i]) cout<<s[2*i-1]<<endl; } return 0; } Re: nima xato Posted by Sunnat 17 Jan 2012 18:21 Xatolaringiz juda ko'p, asosiy o'rindagi xato kiritish jarayonidagi xato! ya'ni "cin" operatori probel tashlanganda ham kiritish tugaganini bildiradi, ism esa 1 talik, 2-talik,3-talik... bo'lishi mumkin Re: nima xato cin.getline(s[i]) yana qanday xato Re: nima xato "cin" tashqari yana nima xato |
|
|