my code is failing one hidden test case .please help!
Q)You will be provided with a number. Print the number of days in the month corresponding to that number.
Note: In case the input is February, print 28 days. If the Input is not in valid range print Error.
Input Description: The input is in the form of a number.
Output Description: Find the days in the month corresponding to the input number.
Print Error if the input is not in a valid range.
#include <iostream>
using namespace std;
int main() {
// your code goes here
int n;
cin>>n;
if(!(n==1 || n==2 || n==3 || n==4 || n==5 || n==6 || n==7 || n==8 || n==9 || n==10 || n==11 || n==12))
{
cout<<"Error";
return 0;
}
int a[n+1];
a[1]=31;
a[2]=28;
a[3]=31;
a[4]=30;
a[5]=31;
a[6]=30;
a[7]=31;
a[8]=31;
a[9]=30;
a[10]=31;
a[11]=30;
a[12]=31;
cout<<a[n];
return 0;
}