Debug my code please!

Question-:CCOOK Problem - CodeChef
Code-:CodeChef: Practical coding for everyone

anyone???

why r u storing all values in a single dimensional array .i think u should use two d array

u can use this as a refrence CodeChef: Practical coding for everyone

Thanks

https://www.codechef.com/viewsolution/48603194
Try This

This should be the correct code

#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
while(n–)
{
int arr[5];
for(int i=0;i<5;i++)
{
cin>>arr[i];
}
int count=0;
for(int i=0;i<5;i++)
{
if(arr[i]==1)
{
count++;
}
}
if(count==0)
{
cout<<“Beginner”<<endl;
}
else if(count==1)
{
cout<<“Junior Developer”<<endl;
}
else if(count==2)
{
cout<<“Middle Developer”<<endl;
}
else if(count==3)
{
cout<<“Senior Developer”<<endl;
}
else if(count==4)
{
cout<<“Hacker”<<endl;
}
else{
cout<<“Jeff Dean”<<endl;
}
}
return 0;
}

One sweet thing about CodeChef is that you do not have to take all the inputs before processing the output. For example, you can take in the first 5 numbers as the input (after the test case) and output the answer to those. Then take the next five numbers as the input and output the answer to those, etc.

You can refer this solution.