# | Problem | Pass Rate (passed user / total user) |
---|---|---|
13719 | EE2310_Lab_10_1 |
|
13720 | EE2310_Lab_10_2 |
|
Description
Redo Lab 3-3 using C++. Write a C++ program to input a date in year 2022 and find out which day of the week it is.As usual, there should be a new line at the end of the output string. You should exclude invalid inputs like Lab 3-2, too. Use
cout << "Input Error" << endl;
for outputting all invalid inputs.
To input a date with a slash
10/14
declare a dummy character and two integers and use cin as follows.
char dummy;
int month, day;
cin >> month >> dummy >> day;
Input
10/14
Output
Friday
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Write a C++ program that asks the user to input today's date and his/her birthday. Your program simply outputs them according to some format, then it checks whether they are equal. If they are, output "Happy birthday\n".
The main function is given. All you need to do is implementing the output member function. Here is a template of your code.
//--------------------------------------------
#include <iostream>
using namespace std;
class DayOfYear{
public:
void output(); //member func. prototype
int month;
int day;
};
void DayOfYear::output(){
/*
* Your work here
*/
}
Input
10/14
10/14
Output
Today is Oct 14
Your birthday is Oct 14
Happy birthday!