How to get weekday with a number in C++ Coding

#include <iostream>
using namespace std;

int main()
{
int day;

lunar:
printf(“\nEnter no of weekday (0 for exit)”);
scanf(“%d”,&day);
switch (day)
{
case 0:
exit(0);
break;
case 1:
cout << “Monday”;
break;
case 2:
cout << “Tuesday”;
break;
case 3:
cout << “Wednesday”;
break;
case 4:
cout << “Thursday”;
break;
case 5:
cout << “Friday”;
break;
case 6:
cout << “Saturday”;
break;
case 7:
cout << “Sunday”;
break;

}

goto lunar;
return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *