Please help with array

I need a program that displays the number of days in each month. When I tried to execute the code, it gave me a black screen with a bunch of fast running digits/letters(couldn't see, very fast). and then it just stopped. Did I do something stupid in my code? I appreciate any help.

#include <iostream>
#include <string>

using namespace std;
int main()
{
int i=0;
string month[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
int days[] = {31,28,31,30,31,30,31,31,30,31,30,31};
{
for(i=0;i<12;i++);
{
cout << month[i]<<" has "<<days[i]<<" days.";
}
system("pause");

return 0;
}
}
If you consider adding a semicolon after the for loop condition stupid...
Last edited on
I am new to C++ so don't be mean! Thank you anyway
anyone can help me with the format of the output? I want each month on each line but do not know how to. Thanks
I wasn't being mean.... I said if you consider that stupid... You asked if you did something stupid...
Did you even try printing a new line character or maybe try to study some documentation or tutorials on C++ input and output?

http://www.cplusplus.com/doc/tutorial/basic_io/
Please use code tags
http://www.cplusplus.com/articles/z13hAqkS/

cout << month[i]<<" has "<<days[i]<<" days." << endl;
Thank y'all very much. I really appreciate all the help :)
Topic archived. No new replies allowed.