Need a Little help on a current date Program

I can't figure out how to switch the month from its current form of MM to the full month name like MAY or JUNE. is there a simple way to do this or do I have to start all over? heres what I have so far
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  #include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    cout<< "name \n \n";
    
    cout<< "CSCI_1101 \n";
    
    cout<< "Intro_to_Computers_and_problem_solving \n";
    cout<< "C-Programming_Project_1 \n \n";
    
    time_t curTime = time(NULL);
    struct tm * now = localtime( & curTime);
    cout<< (now->tm_year + 1900) << "-"
    << (now->tm_mon + 1) << "-"
    <<  now->tm_mday
    << endl;

    system("PAUSE");
    return EXIT_SUCCESS;
}
Last edited on
Create an array of month names.

1
2
3
const string month_names[12] = { "Jan", "Feb", ... };
...
cout << month_names[now->tm_mon];



ahhhh I feel like an idiot haha thanks tho!! :)
Topic archived. No new replies allowed.