ans me plz

Well, the most widely supported method would be the ctime library:

#include <ctime>
#include <iostream>
#include <utility>
#include <string>

using namespace std;

pair<string, int> weekday(int month, int day, int year)
{
    tm date = {0};

    // Set the date properties
    date.tm_mday = day;
    date.tm_mon = month - 1;
    date.tm_year = year - 1900;

    // Let the library correct any discrepancies in the parameters
    time_t normalized_date = mktime(&date);
    char buf[1024];

    // Extract the user-friendly weekday name
    strftime(buf, sizeof buf, "%A", localtime(&normalized_date));

    return make_pair(string(buf), date.tm_wday);
}

int main() 
{
    pair<string, int> day = weekday(1, 1, 2014);

    cout << day.first << "(" << day.second << ")" << '\n';
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.