지금 enums 및 structs를 배우고 있으며 해결할 수없는 경우가 있습니다. 기본 구조체가 있고 직원을 정의하면 다음을 수행 할 수 있습니다.C에서 구조체 내의 열거 형에 정수 값 할당?
저는 직원을 첫 번째 항목에 추가했지만 사용자가 정수를 입력 한 다음 그 정수를 가질 수있는 방법은 무엇입니까? 구조체 내에 중첩 된 enum을 사용하여 Low, Medium 또는 High에 할당? 감사!
struct add {
char employee[255];
enum EmployeeLevel {Low = 0, Medium, High};
};
struct add EMP[10]; //Global variable to add employees using the add struct
printf("Please enter employee name\n");
scanf("%s", EMP[0].employee); //Assigns the user input to the name of the first employee