Hello friends i have a doubt.. i am working on a Qt based application where i show some temperature data. I have a look up table where i save a temperature value to the db for a decimal value.. Right now i have the decimal value data into a QString which i am comparing with the decimal value and appending the equivalent Temperature value into a QVector which i am saving into the database.
Qt Code:
  1. if(str=="387")
  2. {
  3. temperaturedata.append("0");
  4. }else if(str=="414")
  5. {
  6. temperaturedata.append("10");
  7. }else if(str=="441")
  8. {
  9. temperaturedata.append("20");
  10. }else if(str=="469")
  11. {
  12. temperaturedata.append("30");
  13. }else if(str=="497")
  14. {
  15. temperaturedata.append("40");
  16. }else if(str=="525")
  17. {
  18. temperaturedata.append("50");
  19. }
  20. // And for all the other values also
  21. .
  22. .
  23. .
To copy to clipboard, switch view to plain text mode 
I wanted to know if there was a better way of handling a look up table, i have too many if else statements .. how could i handle this better..

This is how the look up table is.
Qt Code:
  1. Temperature Decimal
  2. -40 289
  3. -39 292
  4. -38 294
  5. -37 296
  6. -36 299
  7. -35 301
  8. -34 303
  9. -33 306
  10. -32 308
  11. -31 311
  12. -30 313
  13. -29 315
  14. -28 318
  15. -27 320
  16. -26 323
  17. -25 325
  18. -24 328
  19. -23 330
  20. -22 333
  21. -21 335
  22. -20 337
  23. -19 340
  24. -18 342
  25. -17 345
  26. -16 347
  27. -15 350
  28. -14 352
  29. -13 355
  30. -12 358
  31. -11 360
  32. -10 363
  33. -9 365
  34. -8 368
  35. -7 370
  36. -6 373
  37. -5 375
  38. -4 378
  39. -3 381
  40. -2 383
  41. -1 386
  42. 0 388
  43. 1 391
  44. 2 394
  45. 3 396
  46. 4 399
  47. 5 401
  48. 6 404
  49. 7 407
  50. 8 409
  51. 9 412
  52. 10 415
  53. 11 417
  54. 12 420
  55. 13 423
  56. 14 425
  57. 15 428
  58. 16 431
  59. 17 433
  60. 18 436
  61. 19 439
  62. 20 441
  63. 21 444
  64. 22 447
  65. 23 449
  66. 24 452
  67. 25 455
  68. 26 458
  69. 27 460
  70. 28 463
  71. 29 466
  72. 30 469
  73. 31 471
  74. 32 474
  75. 33 477
  76. 34 480
  77. 35 483
  78. 36 485
  79. 37 488
  80. 38 491
  81. 39 494
  82. 40 497
  83. 41 499
  84. 42 502
  85. 43 505
  86. 44 508
  87. 45 511
  88. 46 514
  89. 47 516
  90. 48 519
  91. 49 522
  92. 50 525
To copy to clipboard, switch view to plain text mode 

looking for some help.

Thank you