我无法让我的 if 语句起作用。并且不管周末的数字是多少,如果声明不断出现。我知道我之前问过一个类似的问题,但无论我尝试了什么都行不通
#include <iostream>
#include <string>
using namespace std;
int main ()
{
int day;
cout << " Enter day of the week " << endl;
cin >> day;
switch (day)
{
case 1 :
case 6 :
case 7 :
cout << "weekend";
break;
case 2 :
case 4 :
cout << "going to C++ Class";
break;
case 3 :
case 5 :
cout << "studying for C++ Class";
break;
default :
cout << "invalid day number";
}
if ( day == 1 || 6 || 7)
cout << "weekend" << endl;
else
if (day == 2 || 4)
cout << "Going to C++ Class";
else
if (day == 2 || 5)
cout << "studying for C++ Class";
else
if ( day < 1 || day > 7)
cout << "bad day number";
system("pause");
return 0;
}