diff --git a/Hackerrank/COOK82A.cpp b/Hackerrank/COOK82A.cpp new file mode 100644 index 00000000..75b2c018 --- /dev/null +++ b/Hackerrank/COOK82A.cpp @@ -0,0 +1,50 @@ +#include +#include +#include +#include +using namespace std; +int main() +{ + + int numofiterations; + scanf("%d", &numofiterations); + int i,j;//loopnig variables + char teamname[30]; + + int goals[4]; + + int teamgoals; + for (i=0;i>teamname>>teamgoals; + + if (strcmp(teamname,"Barcelona")==0 ) + { + goals[0]=teamgoals; + } + else if(strcmp(teamname,"Malaga")==0) + { + goals[1]=teamgoals; + } + else if(strcmp(teamname,"RealMadrid")==0) + { + goals[2]=teamgoals; + } + else //if(teamname=="Eibar") + { + goals[3]=teamgoals; + } + } + + if (goals[1]>goals[2] && goals[0]>goals[3]) + { + printf("Barcelona\n"); + } + else + printf("RealMadrid\n"); + } + + +}