⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 enumdemo.cpp

📁 C++&datastructure书籍源码,以前外教提供现在与大家共享
💻 CPP
字号:
#include <iostream>
#include <string>
using namespace std;

#include "randgen.h"

int main()
{
   enum spectrum{red, orange, yellow, green, blue, indigo, violet};
   
   string specstrings[] = {"red", "orange", "yellow", "green",
                           "blue", "indigo", "violet"};
   RandGen gen;
   spectrum color = spectrum(gen.RandInt(red,violet)); 
   cout << specstrings[color] << endl;
   
   if (color == red)
   {    cout << "roses are red" << endl;
   }
   else
   {    cout << "that's a pretty color" << endl;
   }
   return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -