私は取得していますエラーは、私が;
if (thisisanumber==5)
後だけでなく、else (thisisanumber!=5)
後に追加することで、コードを固定しようとしたerror: expected ' ; ' before ' { ' token
コードの解析エラー:予期した '; 'before' {'token - これは何の原因ですか?
です。これにより最初のエラーが解決され、error: ' else ' without a previous ' if '
という別のエラーが作成されます。私は本当にコードを書いて何の誤りがあったのか知りたいと思っています。ここで
は私のコードです:
#include <iostream>
using namespace std;
int main()
{
int thisisanumber;
cout<<"Whats the Password?: ";
cin>> thisisanumber;
cin.ignore();
if (thisisanumber==5) {
cout<<"You've discovered the password! Wow, you're a genious you should be proud./n";
}
else (thisisanumber!=5) {
cout<<"You've failed in knowing the password and therefore cannot enter, leave and do not come back. Goodbye!/n";
}
cin.get();
}
最初は、mainをintとして返すと宣言しましたが、return文はどこにも表示されません。 – cgmb
@ Slavik81 'main'はC++で暗黙的に0を返します。 –
エラーの対象となる行はどれですか?また、あなたの質問と無関係のFYI、改行は\ nではない/ n – Loduwijk