Я не могу закончить свой код, потому что теперь путаюсь в терминах вызова индекса в моем массиве.. Пожалуйста помочь
You’ve been asked to write a C program to satisfy the following three requirements: • Requirement 1: Ask the user to enter the course code. • Requirement 2: If the course code matches one from the list shown in Table 2, then the message shown in bolt below should be displayed to the user. For example, let’s assume that the user enters the 3093 code. EEE3093: Course level = 3, Credits = 16 • Requirement 3: If the course code does not match one from the list shown in Table 2, then the message shown in red below should be displayed to the user. For example, let’s assume that the user enters an incorrect code of 3193. An invalid course code of EEE3193 was entered Number Code Course level Number of credits 1 1007 1 12 2 2047 2 16 3 2044 2 16 4 2046 2 16 5 3096 3 16 6 3095 3 18 7 3093 3 16 8 3100 3 16 9 3097 3 8 10 3094 3 16 11 3099 3 8 12 3098 3 8 13 4006 4 8 14 4051 4 8 15 4123 4 8 16 4122 4 8 17 4022 4 40
Что я уже пробовал:
#include <stdio.h> #include <stdint.h> int main() { int code, found = 0; int courses [3][17] = { {1007,2047,2044,2046,3096,3095, 3093, 3100, 3097, 3094, 3099, 3098,4006, 4051,4123,4122, 4022}, {1,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4}, {12,16,16,16,16,18,16,16,8,16,8,8,8,8,8,40}}; printf("Enter course code "); scanf("%d", &code); for (int j =0; j<17; j++) { if (courses[0][j] = code ) { printf("EEE%d: Course level = %d, Credits = %d", courses[0][j],courses[1][j],courses[2][j]); found = 1; break; } } if (found == 0) { printf("An invalid course code of EEE%d was entered",code); } return 0; }