我有一个使用新UI系统的下拉列表;我可以读取枚举的值,并毫无问题地填充下拉列表。
foreach (myclass.myenum the_enum in myclass.myenum.GetValues(typeof(myclass.myenum)))
{
the_dropdown.options.Add(new Dropown.OptionData() { text = the_enum.ToString()});
}
现在,当我读取值时,我会返回与所选条目相关的int值。有没有办法将值作为枚举或文本;而不是作为int?
答案 0 :(得分:1)
只是转换你的int值
#include "C:/std_lib_facilities.h"
int main()
{
double smallestSoFar = std::numeric_limits<double>::max();
double largestSoFar = std::numeric_limits<double>::min();
double a,differ=0;
char c=' ';
cout << "Enter value: \n";
while (c != '|' && cin >> a)
{
if (a > largestSoFar)
{
largestSoFar = a;
cout <<"Largest so far is: "<< largestSoFar << endl;
}
else if (a < smallestSoFar)
{
smallestSoFar = a;
cout <<"Smallest so far is: "<< smallestSoFar << endl;
}
else if(smallestSoFar >= a && a<=largestSoFar)
cout << a << endl;
cout << "Enter a character | to break loop: \n";
cin >> c;
}
cout << "You have exited the loop.\n";
keep_window_open();
}