#pragma warning(disable:4786) #include #include #include using namespace std; typedef map > INT2STRING; int main() { INT2STRING theMap; INT2STRING::iterator theIterator; string theString = ""; int index; theMap.insert(INT2STRING::value_type(0, "Zero")); theMap.insert(INT2STRING::value_type(1, "One")); theMap.insert(INT2STRING::value_type(2, "Two")); theMap.insert(INT2STRING::value_type(3, "Three")); theMap.insert(INT2STRING::value_type(4, "Four")); theMap.insert(INT2STRING::value_type(5, "Five")); theMap.insert(INT2STRING::value_type(6, "Six")); theMap.insert(INT2STRING::value_type(7, "Seven")); theMap.insert(INT2STRING::value_type(8, "Eight")); theMap.insert(INT2STRING::value_type(9, "Nine")); for (;;) { cout << "Enter "q" to quit, or enter a Number: "; cin >> theString; if(theString == "q") break; theIterator = theMap.find(theString[0] - '0'); cout << theIterator->second; cout << endl; } return 0; }
上一篇 2023王道C语言训练营(线索二叉树)
下一篇 001、macOS安装torchserve
版权所有 (c)2021-2022 MSHXW.COM
ICP备案号:晋ICP备2021003244-6号