本帖最后由 mdl2999_52pj 于 2021-6-1 13:59 编辑
# include <iostream>
# include <array>
//c++17
using namespace std;
int main()
{
const char *pstars[]{
"Fatty Arbuckle",
"Calara Bow",
"Lassie",
"Slim Pickens",
"Boris Karloff"
};
cout << "Enter a luck start! Enter a number between 1 and " << size(pstars) << endl;
size_t choice;
cin>> choice;
if (choice <1 and choice > size(pstars))
{
cout << "Sorry, yout don't have a lucky star!" << endl;
}
else
{
cout << "Your luck star is " << pstars[choice-1] << endl;
}
}
|