how to write a program that can accept a date from user and print the day on which it occurs

Er, did you mean to start a poll with a random question in it?

To answer your (post) question:

  1. Read in a date from the user as std::string
  2. Parse the string to extract the day, month, year etc.
  3. Calculate the number of days from the date the user entered to some reference date, on which you know the day (eg. today).
  4. Use numberOfDays%7 to get the answer.

Have fun.

What do you have so far?

I voted yes. Partly, because I am psychic and I can tell the OP's code is thousands of pages long.

The struct tm in time.h or ctime contains an integer that represents the day of the week. After getting the date from the keyboard just fill in a struct tm and pass it to mktime() to complete the structure. You must zero out all the elements of the structure before doing that.