I think I am stuck

I am working on some homework for school and I have to use functional decomposition for when someone inputs 1-365 it outputs the month, here is my code so far:

// Friedmann Chapter 5 Assigment
// This program outputs the month from a given day

#include <iostream>
#include <string>

using namespace std;

int main ()

// Set Days of the Month in an array
const int MonthDays[] = {31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365};

// Set Name of each Month in an array
const string MonthName[] = {"January", "Febuary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};

int day;

// Prompt user to input the number of day
cout << "Enter the number of day the you would like to know the month for: " ;
cin >> day;

//Test for negative numbers and number higher that 365
if (day < 0 || day > 365)
cout << "Please enter a valid number (1-365)" << endl;


return 0;


Where I am stuck at is I can not get the output for the month. I think I can do if else statements for each month but I am not sure if that is right. Please HELP!
Topic archived. No new replies allowed.