I have write a calendar code, but I have some stray error. Here is my code:
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int month, year, Y, M;
int day[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int FirstDayofMonth;
cout << "please enter year!" << endl;
cin >> year;
while(year < 1600)
{
cout << "please do not enter year less than 1600!" << endl;
cin >> year;
}
cout << "please enter month! (1~12)" << endl;
cin >> month;
Y = year – (14 – month)/12;
M = month + 12 * ((14 - month) / 12) - 2;
FirstDayofMonth = (Y + Y/4 - Y/100 + Y/400 + 31*M/12 + 1)%7;
}
The other part is to print the result. And it shows me the error below:
try.cpp:18: error: stray ‘\342’ in program
try.cpp:18: error: stray ‘\200’ in program
try.cpp:18: error: stray ‘\223’ in program
try.cpp:18: error: stray ‘\342’ in program
try.cpp:18: error: stray ‘\200’ in program
try.cpp:18: error: stray ‘\223’ in program
try.cpp: In function ‘int main()’:
try.cpp:18: error: expected `)' before ‘month’
try.cpp:18: error: ‘year’ cannot be used as a function
18: Y = year – (14 – month)/12;
I don't know what the error means. How can I fix it?