|
|
вернуться в форумPlease help to find a mistake Послано DD 30 окт 2007 10:30 /* Name:D.cpp Date: Lang:Cpp Environment:MS Visual Studio 2005 Sp1 */ // Defines #define DEBUG 0 #define FILE_INPUT 1 #define FILE_OUTPUT 1 #define FILE_OUTPUT_NAME "D.out" #define FILE_INPUT_NAME "D.in" // Includes #include <cstdio> #include <cmath> #include <cstdlib> #include<string> #include<iostream> // Namespace using namespace std; // SETIO function int setio() { // seting input #if FILE_INPUT // freopen(FILE_INPUT_NAME,"r",stdin); #endif // seting output #if FILE_OUTPUT // freopen(FILE_OUTPUT_NAME,"w",stdout); #endif
// Done,exiting return 0; } // Functions,Procedures,etc // Main function int main() { #ifndef ONLINE_JUDGE setio(); #endif int n,i,a,b,c;string s; a=0;b=0;c=0;s.clear(); cin>>n; for(i=0;i<n;i++) {cin>>s; if (s[0]=='E')a++; else if(s[0]=='M')b++; else if(s[0]=='L')c++; cin>>s; } if (a>b&&a>c) cout<<"Emperor Penguin"<<endl; if (a<b&&b>c) cout<<"Macaroni Penguin"<<endl; else cout<<"Little Penguin"<<endl; //system("pause"); return 0; } Re: Please help to find a mistake #define FILE_OUTPUT_NAME "D.out" #define FILE_INPUT_NAME "D.in" for what is this pice of code??? Edited by author 07.12.2007 14:52 Re: Please help to find a mistake the else statement is related to second if. think about try test 4 E P E P L P M P your program output both Emperor Penguin and Little Penguin |
|
|