一段小程序,不知为何会出警告?
一段小程序,不知为何会出警告?
#include <iostream>
using namespace std;
int main()
{
bool YES=true;
bool switchy=true;
switchy=!true;
cout<<YES<<" "<<switchy<<endl;
switchy=!YES;
cout<<switchy<<endl;
enum Coins
{
PENNY,NICKEL=5,DIME=10,QUART=25
};
Coins pocket;
pocket=NICKEL;
cout<<pocket<<endl;
pocket=QUART;
cout<<pocket<<endl;
}
警告
Warning W8004 2.6.cpp 6: 'switchy' is assigned a value that is never used in function main()