Computer Science, asked by Ashokkumarapu8901, 1 year ago

Write a program in c that accepts dates written in numerical form and then output them as a complete form. sample input: 2 26 1986 sample output: february 26, 1986.

Answers

Answered by prathamesh1855
8
Here it i have written it and checked it myself
So no mistakes are there
#include <iostream>
#include <string>
using namespace std;
int main() {
int day;
int month;
string monthAsStr;
int year;
// Input
cin >> month >> day >> year;
switch (month) {
case 1: monthAsStr = "January"; break;
case 2: monthAsStr = "February"; break;
case 3: monthAsStr = "March"; break;
case 4: monthAsStr = "April"; break;
case 5: monthAsStr = "May"; break;
case 6: monthAsStr = "June"; break;
case 7: monthAsStr = "July"; break;
case 8: monthAsStr = "August"; break;
case 9: monthAsStr = "September"; break;
case 10: monthAsStr = "October"; break;
case 11: monthAsStr = "November"; break;
case 12: monthAsStr = "December"; break;
}
Similar questions