カレンダーのコードを書きましたが、エラーが発生しました。これが私のコードです:
#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;
}
他の部分は、結果を印刷することです。そして、それは私に以下のエラーを表示します
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;
エラーの意味がわからないのですが、どなたか教えていただけないでしょうか? ありがとう!!