#include <stdlib.h>
#include <stdio.h>
using namespace std;
void main(){
char *resolutions[] = { "720x480", "1024x600", "1280x720", "1920x1080" };
int x = 0;
enum ResMode
{
p480,
p600,
p720,
p1080
};
ResMode res = p480;
printf("\nPlease enter the resolution you wish to use now by entering a number");
printf("\n480p[0], 600p[1], 720p[2], 1080p[3]");
gets(res);
printf("\nThe resolution you have selected is %s", resolutions[res]);
}
基本上我想要做的是按下数字键1,然后从枚举中选择p600,并在下一行输出它作为1024x600。但是我遇到了类型转换错误。如何解决?
gets
。它在最新的 C++ 标准中已经不存在了。 - Brian Bigets
。它因为明显的漏洞已经被最新的 C 和 C++ 标准所淘汰。 - Deduplicator