枚举用法enum举例

#include 
using namespace std;
int main()
{

   enum day{sunday,monday,tuesday,wednesday,thursday,friday,saturday};
   day today;
   today = saturday;
   if(today == sunday||today == saturday)
       cout<<"周末"<

例如:

#include 
using namespace std;
enum weektype
{
    monday ,
    tuesday ,
    wednesday,
    thursday,
    friday,
    saturday,
    sunday
};
void go(weektype wt)
{
    switch (wt) {
    case monday:
    cout<<"今天是周一"<


你可能感兴趣的:(※【c++】)