@hazlin For the sake of completeness, this is what I meant. Since I don't think your strings need to be dynamically handled, you could do something like this in C. in C++, your mileage may vary, idk what initializers are supported..
#include <stdio.h> enum { RES_BLACK, RES_BROWN, RES_RED, RES_ORANGE, RES_YELLOW, RES_GREEN, RES_BLUE, RES_PURPLE, RES_GREY, RES_WHITE, RES_GOLD, RES_SILVER, RES_NO_COLOR, RES_NUM_COLORS }; typedef struct ResInfo { char number; unsigned int rgb[3]; char *tol; char *mag; } ResInfo; ResInfo res_info[] = { [RES_BLACK] = (ResInfo) {.number = '0', .rgb = {0, 0, 0}, .tol = "_.__%", .mag = "Ω"}, [RES_BROWN] = (ResInfo) {.number = '1', .rgb = {200, 113, 55}, .tol = "1.00%", .mag = "0Ω"}, [RES_RED] = (ResInfo) {.number = '2', .rgb = {200, 55, 55}, .tol = "2.00%", .mag = "00Ω"}, [RES_ORANGE] = (ResInfo) {.number = '3', .rgb = {255, 102, 102}, .tol = "_.__%", .mag = "kΩ"}, [RES_YELLOW] = (ResInfo) {.number = '4', .rgb = {255, 255, 0}, .tol = "_.__%", .mag = "0kΩ"}, [RES_GREEN] = (ResInfo) {.number = '5', .rgb = { 0, 128, 0}, .tol = "0.50%", .mag = "00kΩ"}, [RES_BLUE] = (ResInfo) {.number = '6', .rgb = { 50, 50, 255}, .tol = "0.25%", .mag = "MΩ"}, [RES_PURPLE] = (ResInfo) {.number = '7', .rgb = {128, 0, 128}, .tol = "0.10%", .mag = "0MΩ"}, [RES_GREY] = (ResInfo) {.number = '8', .rgb = {128, 128, 128}, .tol = "0.05%", .mag = "_"}, [RES_WHITE] = (ResInfo) {.number = '9', .rgb = {255, 255, 255}, .tol = "_.__%", .mag = "_"}, [RES_GOLD] = (ResInfo) {.number = '_', .rgb = {186, 176, 0}, .tol = "5.00%", .mag = "0mΩ"}, [RES_SILVER] = (ResInfo) {.number = '_', .rgb = {204, 204, 204}, .tol = "10.0%", .mag = "mΩ"}, [RES_NO_COLOR] = (ResInfo) {.number = '_', .rgb = { 0, 0, 0}, .tol = "20.0%", .mag = "_"}, }; int main(void) { for (int i = 0; i < RES_NUM_COLORS; i++) { printf ("number: '%c', rgb: (%3u, %3u, %3u), tol: '%s', mag: '%s'\n", res_info[i].number, res_info[i].rgb[0], res_info[i].rgb[1], res_info[i].rgb[2], res_info[i].tol, res_info[i].mag); } return 0; }