Advertisement
e_mccormick

Old Stats Project

Oct 8th, 2013
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 96.16 KB | None | 0 0
  1. //  This is a project I did some time back in an intro c++ class.
  2.  
  3. #include <iostream>
  4. #include <string>
  5. #include <time.h>
  6. #include <conio.h>
  7. #include <math.h>
  8. #include <fstream>
  9. #include <cstdlib>
  10. #include <sstream>
  11.  
  12. using namespace std;
  13.  
  14. /* Statistics Calculator project.
  15.  
  16. A basic statistics calculator.
  17.  
  18. The initial possibilities for this program were:
  19.  
  20.     Do a Corrolation Coefficent (Pearson r) between two arrays.  Output the r and the
  21.         sub results used to get it.
  22.     t-test
  23.     Do a 2 way analysis of variance (ANOVA)
  24.     Z ratio.
  25.  
  26. To assure accuracy, data from an actual statistics class will be used to test the
  27. calculations. As long as the answers match the class data, the calculator should
  28. be doing the proper job.
  29.  
  30. Actual abilities of the program turned out to be less than the initial goal. In
  31. short, doing more than a few tests is not practical unless you are writing an in
  32. depth program.  As a result, a smaller, more closely related set of tests was
  33. chosen. This allows for a more limited range of data to be taken in and dealt
  34. with. It also allows for the project to be finished before the semester is over!
  35.  
  36. I officially HATE misprints. Due to a misprint in Statistics Unplugged, I spent
  37. hours trying to debug my standard deviation formula, when the computer was right
  38. and the book was wrong.
  39.  
  40. Data for tables from:
  41.     Caldwell, Sally. Statistics Unplugged. 3rd. Belmont, CA: Wadsworth Cengage Learning, 2010. Print.
  42.         and
  43.     StatSoft, Inc. Electronic Statistics Textbook, Tulsa, OK: StatSoft, Inc., 2011. Web.
  44.  
  45. Mock values and testing data from:
  46.     MATH/PSYCH 108: Statistics, Summer 2011, Dr. Pfahler.
  47.  
  48. */
  49.  
  50. void pause()
  51. {cout << "\nPress any key.\n"; _getch();}
  52. int inVal(int); // Takes maximum # menu items, returns # or outputs "1 for Help" message.
  53.  
  54. typedef long double* LDPtr;
  55.  
  56. struct modeArr{
  57.     int count;
  58.     long double value;
  59. };
  60.  
  61.  
  62. void psudoStats(long double arr[], int);
  63.  
  64. long double findMean(long double arr[], int);
  65. long double findMedian(long double arr[], int);
  66. int findMode(long double arr[], int, modeArr mode[]);
  67. void exchangeSort(long double arr[], int);
  68. float findStdDev (long double arr[], int);
  69. void printStats(long double arr[], int numStats);
  70. void seedStats(long double arr0[], int&, long double arr1[], int&);
  71. float zScore(float sD, long double mean, long double rZS);
  72. long double longDubIn();
  73. float floatIn(float range);
  74. float zRatio(float zS);
  75. void zRatio2Raw(float sD, long double mean, float zR);
  76. float zRatio2Score(float zR);
  77. float corrAnalysis(long double arr0[], long double arr1[], int&);
  78. void corrSignificance(float pR, int&);
  79. bool loadStatsFile(long double arr[], int&, string);
  80.  
  81. int main()
  82. {
  83.     void printMenu(int numStatsArr[]), printHelp();
  84.     int menuChoice = 0, subChoice = 0, numStats, numModes, wA, whichArr();
  85.     char yN;
  86.     system ("color 17");
  87.     long double mean = -1234567.890987, rS = -1234567.890987;
  88.     float sD, pR, zS, zR;
  89.     bool success = false;
  90.  
  91.     string fileName = "stats.txt";
  92.  
  93.     cout.setf(ios::fixed);
  94.     cout.setf(ios::showpoint);
  95.     cout.precision(2);
  96.  
  97.     int maxStats = 500;
  98.  
  99.            //         1         2         3         4         5         6         7         8
  100.            //12345678901234567890123456789012345678901234567890123456789012345678901234567890
  101.     cout << "This is a very basic statistics calculator.  It takes in values as floating\n"
  102.          << "point numbers and performs a small range of basic options on them.\n\n"
  103.          << "The largest number of samples to work with is defaulted at " << maxStats << ". At this time,\n"
  104.          << "you may change this number.  However, you may not change it later.\n\n"
  105.          << "Would you like to change the maximum number of samples to work with? (y/n) ";
  106.     cin  >> yN;
  107.     if (yN == 'y' || yN == 'Y')
  108.     {
  109.         cout << "What is the new maximum? ";
  110.         cin  >> maxStats;
  111.     }
  112.     cout << endl;
  113.  
  114.     long double * statsArrPtr[2];
  115.     LDPtr statsArr1;
  116.     statsArr1 = new long double[maxStats];
  117.     statsArrPtr[0] = statsArr1;
  118.     LDPtr statsArr2;
  119.     statsArr2 = new long double[maxStats];
  120.     statsArrPtr[1] = statsArr2;
  121.    
  122.     modeArr * mode;
  123.     mode = new modeArr[maxStats];
  124.  
  125.     int numStatsArr[2] = {0,0} ;//= {numStats1, numStats2};
  126.  
  127.     printHelp();
  128.     printMenu(numStatsArr);
  129.  
  130.     do
  131.     {
  132.        
  133.         menuChoice = inVal(9);
  134.         switch(menuChoice)
  135.         {
  136.         case 0:
  137.             cout << "Thank you for using this program. I hope it helped.\n\n"
  138.                 << "Tablular data for calculations, mock values, and testing data from:\n\n"
  139.                 << "\tCaldwell, Sally. Statistics Unplugged. 3rd. Belmont, CA,\n"
  140.                 << "    Wadsworth Cengage Learning, 2010. Print.\n\n"
  141.                 << "\tStatSoft, Inc. Electronic Statistics Textbook, Tulsa, OK,\n"
  142.                 << "    StatSoft, Inc., 2011. Web.\n\n"
  143.                 << "\tPfahler, Dr. Diane. MATH/PSYCH 108: Statistics, Yucaipa, CA,\n"
  144.                 << "    Crafton Hills College, 2011. Lecture.\n\n";
  145.             break;
  146.         case 1:
  147.             printHelp();
  148.             pause();
  149.             printMenu(numStatsArr);
  150.             cout << "\nRetuning to main menu.\n";
  151.             break;
  152.         case 2:
  153.             subChoice = 1;
  154.             do {
  155.                 switch (subChoice)
  156.                 {
  157.                 case 1:
  158.                     cout << "Input, Load, or Generate Data \n"
  159.                         //           1         2         3         4         5         6         7         8
  160.                         //  12345678901234567890123456789012345678901234567890123456789012345678901234567890
  161.                         << "From this menu you can pick from pre-made test data, load data from a file, \n"
  162.                         << "or generate fake test data.\n\n"
  163.                         << "Data that is loaded must be in a text file, one item per line. If it will be\n"
  164.                         << "used in a Correlation Analysis (Pearson's r,) the fist data set will be one \n"
  165.                         << "value and the second data set will be the other. Also, r requires that both \n"
  166.                         << "files have the same number of lines.\n\n"
  167.                         << "The pre-made test data is from a statistics class and gives verified results.\n\n"
  168.                         << "Generated test data uses a normal distribution.\n\n";
  169.                     break;
  170.                 case 2:
  171.                         cout << "This overwites an array with \"normal\" data from -100 to +100 with a\n"
  172.                             << "distribution that follows a normal curve.  While normalized in shape, the\n"
  173.                             << "data is otherwise very random and unsorted. \n"
  174.                             << "NOTE: This is NOT a good way to test the Correlation Analysis.\n"
  175.                             << "Continue? (y/n) ";
  176.                         cin  >> yN;
  177.                         if (yN == 'y' || yN == 'Y')
  178.                         {
  179.                         wA = whichArr();
  180.                         while ((cout << "How many psudostats? ") && (!(cin >> numStats) || numStats < 1 || numStats > maxStats))
  181.                         {
  182.                             cout << "That is not a valid entry. It must be postitive and less than " << maxStats << ".";
  183.                             cin.clear();
  184.                             cin.ignore(numeric_limits<streamsize>::max(), '\n');
  185.                         }
  186.                         numStatsArr[wA] = numStats;
  187.                         psudoStats(statsArrPtr[wA], numStatsArr[wA]);
  188.                         }
  189.                     break;
  190.                 case 3:
  191.                     cout << "Copy one data set to the other.\n"
  192.                         << "You select the source array and it overwrites the other.\n";
  193.                     wA = whichArr();
  194.                     if (wA)
  195.                     {
  196.                         for (int i=0; i < numStatsArr[1];i++)
  197.                         {
  198.                             statsArr1[i] = statsArr2[i];
  199.                         }
  200.                         numStatsArr[0] = numStatsArr[1];
  201.                     }
  202.                     else
  203.                     {
  204.                         for (int i=0; i < numStatsArr[0];i++)
  205.                         {
  206.                             statsArr2[i] = statsArr1[i];
  207.                         }
  208.                         numStatsArr[1] = numStatsArr[0];
  209.                     }
  210.                     break;
  211.                 case 4:
  212.                     wA = whichArr();
  213.                     cout << "Sorting.\n";
  214.                     exchangeSort(statsArrPtr[wA], numStatsArr[wA]);
  215.                     cout << "Finished.\n";
  216.                     cout << "Returning to Input, Load, or Generate Data.\n";
  217.                     break;
  218.                 case 5:
  219.                     cout << "The pre-made test data comes in a few flavors to allow different operations.\n"
  220.                         << "The small data sets require up to a maximum of 30 stats be enterable.\n\n";
  221.  
  222.                     if (maxStats < 30) cout << "The maximum number of stats, " << maxStats << " is too low for this.";
  223.                     else
  224.                     {
  225.                         cout << "At least one data set will be be overwritten. Continue? (y/n) ";
  226.                             cin  >> yN;
  227.                             if (yN == 'y' || yN == 'Y')
  228.                             {
  229.                                 seedStats(statsArrPtr[0], numStatsArr[0], statsArrPtr[1], numStatsArr[1]);
  230.                             }
  231.                     }
  232.                     break;
  233.                 case 6:
  234.                         //           1         2         3         4         5         6         7         8
  235.                         //  12345678901234567890123456789012345678901234567890123456789012345678901234567890
  236.                     cout << "This program reads in statistics as a one item per line file. It will not \n"
  237.                         << "know what to do with non-numeric data, multiple items per line, or any other \n"
  238.                         << "issue. Also, if you need to load paired data for a Correlation Analysis, load \n"
  239.                         << "the first item into the first statistics array and the second item into the \n"
  240.                         << "other. It can take in positives or negatives up to the maximum samples limit.\n\n"
  241.                         << "WARNING: Blank lines load as zeros! \n\n"
  242.                         << "Would you like to load a file into one of the statistics arrays? ";
  243.                     cin  >> yN;
  244.                     if (yN == 'y' || yN == 'Y')
  245.                     {
  246.                     cout << "\nThe corrent file name that will be loaded is:\n"
  247.                         << "\t" << fileName << endl
  248.                         << "Would you like to change the file that would be loaded? (y/n) ";
  249.                     cin  >> yN;
  250.                     if (yN == 'y' || yN == 'Y')
  251.                     {
  252.                         cout << "New filename: ";
  253.                         cin.sync();
  254.                         getline(cin, fileName, '\n');
  255.                         cin.clear();
  256.                     }
  257.                     cout << "\nWhich set of starts to load into?\n";
  258.                     wA = whichArr();
  259.                     success = loadStatsFile(statsArrPtr[wA], numStatsArr[wA], fileName.c_str());
  260.                     if (success == false)
  261.                     {
  262.                         cout << "Can not find: " << fileName << "\nReturning to Input, Load, or Generate Data\n\n";
  263.                         break;
  264.                     }
  265.                     else cout << "File loaded into array " << (wA+1) << ".\n\n";
  266.                     }
  267.                     break;
  268.                 }
  269.                 cout << "\t0: Exit back to the main menu.\n"
  270.                     << "\t1: Instructions.\n"
  271.                     << "\t2: Generate Psudostats.\n"
  272.                     << "\t3: Copy one data set to the other.\n"
  273.                     << "\t4: Sort a data set.\n"
  274.                     << "\t5: Use pre-made test data.\n"
  275.                     << "\t6: Load from a file.\n"
  276.                     << "\tSelection: ";
  277.                     subChoice = inVal(6);
  278.             } while (subChoice);
  279.             cout << "\nRetuning to main menu.\n";
  280.             printMenu(numStatsArr);
  281.             break;
  282.         case 3:
  283.             cout << "Dumping stats.\n\n";
  284.             wA = whichArr();
  285.             printStats(statsArrPtr[wA], numStatsArr[wA]);
  286.             cout << "\nRetuning to main menu.\n";
  287.             break;
  288.         case 4:
  289.             wA = whichArr();
  290.             numModes = findMode(statsArrPtr[wA], numStatsArr[wA], mode);
  291.             cout << "Finding Measures of Central Tendency\n"
  292.                  << "\tMean: " << findMean(statsArrPtr[wA], numStatsArr[wA]) << endl
  293.                  << "\tMedian: " << findMedian(statsArrPtr[wA], numStatsArr[wA]) << endl
  294.                  << "\tMode: ";
  295.             for (int i = 0; i < numModes; i++)
  296.                 if (mode[0].count == mode[i].count) cout << mode[i].value << ", ";
  297.             cout << "\b\b (" << mode[0].count << ")\n";
  298.             cout << "Standard Deveation is: " << findStdDev(statsArrPtr[wA], numStatsArr[wA]) << endl;
  299.             cout << "\nRetuning to main menu.\n";
  300.             break;
  301.         case 5:
  302.             subChoice = 1;
  303.             do {
  304.                 switch (subChoice)
  305.                 {
  306.                 case 1:
  307.                     cout << "Z Ratio Caclulations. \n"
  308.                         //           1         2         3         4         5         6         7         8
  309.                         //  12345678901234567890123456789012345678901234567890123456789012345678901234567890
  310.                         << "    This requires a raw score, standard deviation (SD), and mean. It does\n"
  311.                         << "    operations that relate to the ratio of the raw score to the mean in SD \n"
  312.                         << "    units, AKA: the Z Score. A Z < 1 and > -1 is normal and represents roughly\n"
  313.                         << "    68% of the population. If a Z score is outside that range, it is\n"
  314.                         << "    significant. 1 < |Z| < 2 is above/below average and has roughly 27% of\n"
  315.                         << "    the population, 2 < |Z| < 3 is very above/below at about 4%, and |Z| > 3\n"
  316.                         << "    is exceptionally rare at about 1%. Because this is both above and below, an\n"
  317.                         << "    SD 3+ is actualy less than half a percent of the population.\n"
  318.                         << endl
  319.                         << "    With this Z Ratio Caclulator, you can turn data into SD, see where it \n"
  320.                         << "    falls in relation to other data, and perform other Z based operations.\n\n"
  321.                         << "    The some data is always input. The SD and mean may be input or calculated.\n"
  322.                         << "    Z Ratio operations are available after SD and mean data are set.\n\n";
  323.                     break;
  324.                 case 2:
  325.                     wA = whichArr();
  326.                     mean = findMean(statsArrPtr[wA], numStatsArr[wA]);
  327.                     sD = findStdDev(statsArrPtr[wA], numStatsArr[wA]);
  328.                     break;
  329.                 case 3:
  330.                     cout << "What SD would you like to use?\n";
  331.                     sD = floatIn(99999.9);
  332.                     cout << "What mean would you like to use?\n";
  333.                     mean = longDubIn();
  334.                     break;
  335.                 case 4:
  336.                     cout << "What raw score would you like to evaluate?\n";
  337.                     rS = longDubIn();                  
  338.                 case 5:
  339.                     if (rS == -1234567.890987)
  340.                     {
  341.                         cout << "What raw score would you like to evaluate?\n";
  342.                         rS = longDubIn();
  343.                     }
  344.                     zS = zScore(sD, mean, rS);
  345.                     zR = zRatio(zS);
  346.                     cout << "The raw score " << rS << " is " << " Z = " << zS << endl
  347.                         << "from the mean of " << mean << " when the standard deviation is " << sD << ".\n"
  348.                         << "The percentage of the scores are between " << rS << " and " << mean << " is " << (zR * 100) << "%.\n\n";
  349.  
  350.                     break;
  351.                 case 6:
  352.                         cout << "What Z Ratio from -50.00 to 50.00 would you like to evaluate?\n"
  353.                             << "This represents 100%, with 50% (the mean) being 0.\n\n";
  354.                         zR = floatIn(50.00);
  355.                         zRatio2Raw(sD, mean, (zR/100.0));
  356.                     break;
  357.                 }
  358.                 cout << "\t0: Exit back to the main menu.\n"
  359.                     << "\t1: Show Z Ratio instructions again.\n"
  360.                     << "\t2: Calculate SD and mean from stats that have already been loaded.\n"
  361.                     << "\t3: Manually enter SD and mean.\n";
  362.                     if (mean != -1234567.890987)
  363.                     {
  364.                         cout << "\t4: Change raw score and perform Z Ratio Caclulation.\n"
  365.                             << "\t5: Perform Z Ratio Caclulation.\n"
  366.                             << "\t6: Convert a Z Ratio percentage into a SD and raw score.\n";
  367.                         subChoice = inVal(6);
  368.                     }
  369.                     else
  370.                     {
  371.                         cout << "\tSelection: ";
  372.                         subChoice = inVal(3);
  373.                     }
  374.             } while (subChoice);
  375.             cout << "\nRetuning to main menu.\n";
  376.             break;
  377.             case 6:
  378.                 subChoice = 1;
  379.                 do {
  380.                     switch (subChoice)
  381.                     {
  382.                     case 1:
  383.                         cout << "Correlation Analysis, AKA: Pearson's r.\n"
  384.                             //           1         2         3         4         5         6         7         8
  385.                             //  12345678901234567890123456789012345678901234567890123456789012345678901234567890
  386.                             << "    This requires both data sets be filled with the same number of entries. \n"
  387.                             << "    The term Correlation Analysis is very literal. It evaluates (analyzes) the\n"
  388.                             << "    relationship (correlation) between two values on a set of subjects. In \n"
  389.                             << "    this program, the number of samples is the number of subjects. The \n"
  390.                             << "    statistics sets 1 and 2 will each represent one of the two values, which\n"
  391.                             << "    is why they must have the same number of entries.\n\n"
  392.                             << "    DO NOT SORT THE DATA! \n"
  393.                             << "    If you sort, the relationships will be lost.\n\n";
  394.                         break;
  395.                     case 2:
  396.                         cout << "The results are given in the form r = {-1 to 1}. If r = 0, there is no\n"
  397.                              << "relationship. If r is 1, a perfect positive relationship exists and as value\n"
  398.                              << "1 goes up, value 2 goes up an equal ratio. If r = -1, this is a perfect\n"
  399.                              << "inverse relationship where as one goes up the other goes down. All other\n"
  400.                              << "values represent a less strong relationship, which is normal.\n\n"
  401.                              << "The rule of thumb for results is, an |r| of:\n"
  402.                              << "    .0 to .2 means no to very little relationship,\n"
  403.                              << "    .2 to .4 means a weak relationship,\n"
  404.                              << "    .4 to .6 means a moderate relationship,\n"
  405.                              << "    .6 to .6 means a strong relationship, and\n"
  406.                              << "    .8 to 1.0 means a very strong to perfect relationship.\n\n"
  407.                              << "There is also the question of if your results are mainingful. ";
  408.                         pause();
  409.                         cout << "\nWhen a Correlation Analysis is performed, how accurate it is depends on\n"
  410.                              << "something called the Critical Values, which relates to the Degrees of\n"
  411.                              << "Freedom. The Degrees of Freedom is very simple, the number of samples - 2.\n"
  412.                              << "However, using it requires a table. Here are some sample results:\n\n"
  413.                              << "With 5 samples and an r = .4, a weak to moderate relationship seems possible,\n"
  414.                              << "but the results would be discarded because 5 samples is 3 DF, which requires \n"
  415.                              << "r = .404 to be acceptable 50% of the time, or r = .8054 for 90% of the time. \n"
  416.                              << "In contrast, with 50 samples an r of .2353 is significant 90% of the time.\n\n"
  417.                              << "This program will output the level of significance in a wide range.\n"
  418.                              << "However, only 90% or better is acceptable for real studies. Lower\n"
  419.                              << "percentages generally mean you need to refine your study. Also, the DF\n"
  420.                              << "table used sees all DF > 100 as 100, but that is still valid.\n\n";
  421.  
  422.                     break;
  423.                     case 3:
  424.                         pR = corrAnalysis(statsArrPtr[0], statsArrPtr[1], numStatsArr[0]);
  425.                         cout << "The correlation results are r = " << pR << "\n\n";
  426.                         corrSignificance(pR, numStatsArr[0]);
  427.                     break;
  428.                     }
  429.                     cout << "\t0: Exit back to the main menu.\n"
  430.                         << "\t1: Show Correlation Analysis instructions again.\n"
  431.                         << "\t2: Interpreting results.\n";
  432.                     if (numStatsArr[0] != numStatsArr[1])
  433.                     {
  434.                         cout << "\nThe number of stats in the samples do not match. You must exit "
  435.                             << "to the main menu and fix this before continuing.\n";
  436.                         subChoice = inVal(2);
  437.                     }
  438.                     else
  439.                     {
  440.                         cout << "\t3: Perform a Correlation Analysis on the data.\n";
  441.                         subChoice = inVal(3);
  442.                     }
  443.             } while (subChoice);
  444.             cout << "\nRetuning to main menu.\n";
  445.             break;
  446.         default:
  447.             printMenu(numStatsArr);
  448.         }
  449.        
  450.     }while(menuChoice);
  451.  
  452.     pause();
  453.     return(0);
  454. }// main()
  455.  
  456. void printMenu(int numStatsArr[])
  457. {
  458.     cout << "\nPick an option:\n"
  459.          << "\t0: Exit.\n"
  460.          << "\t1: Help.\n\n"
  461.          << "\t2: Load, generate, or manipulate data.\n\n";
  462.     if (numStatsArr[0] == 0 && numStatsArr[1] == 0) cout << "Data must exist before you can see other options.";
  463.     else
  464.     {
  465.     cout << "\t3: Dump data to screen.\n"
  466.          << "\t4: Measures of Central Tendency.\n"
  467.          << "\t5: Z Ratio Operations.\n"
  468.          << "\t6: Correlation Analysis (r).\n\n"
  469.          << "\t9: Show this menu again.\n";
  470.     }
  471. } // end printMenu()
  472.  
  473.  
  474. void printHelp()
  475. {
  476.            //         1         2         3         4         5         6         7         8
  477.            //12345678901234567890123456789012345678901234567890123456789012345678901234567890
  478.     cout << "The followng operations may be performed with this program:\n"
  479.          << endl
  480.          << "Load, generate, or manipulate data: Take in data from a file, use pre-made \n"
  481.          << "    data, use a normal curve generator, and then do basic manipulations like \n"
  482.          << "    sorting or adding significance.\n"
  483.          << "Dump data to screen: Basic screen output of raw data.\n"
  484.          << "Measures of Central Tendency: Sorted data is converted into the mean (average),\n"
  485.          << "    median (center most value), and mode (most frequent value).\n"
  486.          << "Z Ratio Operations: Z is a statistical comparison based on standard deviation\n"
  487.          << "    from the mode. This allows a few basic operations related to Z.\n"
  488.          << "Correlation Analysis AKA: Pearson's r: A measure of two values to see if when\n"
  489.          << "    the first (independent) value goes up or down, the second (dependent) \n"
  490.          << "    value also goes up or down, does the opposite, or is not related.\n\n";
  491. }// end printHelp()
  492.  
  493. void printStats(long double arr[], int numStats)
  494. {
  495.     int wrap=0;
  496.     for(int i = 0; i < numStats; i++)
  497.     {
  498.         cout << arr[i] << " ";
  499.         if (arr[i] > 99999.99 || arr[i] < -9999.99) wrap += 10;
  500.         else if (arr[i] > 9999.99 || arr[i] < -999.99) wrap += 9;
  501.         else if (arr[i] > 999.99 || arr[i] < -99.99) wrap += 8;
  502.         else if (arr[i] > 99.99 || arr[i] < -9.99) wrap += 7;
  503.         else if (arr[i] > 9.99 || arr[i] < -.99) wrap += 6;
  504.         else if (arr[i] > .99 || arr[i] < -.09) wrap += 5;
  505.         else wrap += 4;
  506.         if (wrap > 70)
  507.         {
  508.             wrap = 0;
  509.             cout << endl;
  510.         }
  511.     }
  512.     cout << endl;
  513. }
  514.  
  515. int inVal(int y)
  516. {
  517.     int x;
  518.     while ((cout << "\nMenu Selection: ") &&
  519.            (!(cin >> x) || x < 0 || x > y))
  520.     {
  521.         cout << "That is not a valid entry. Try again or 1 for help. ";
  522.         cin.clear();
  523.         cin.ignore(numeric_limits<streamsize>::max(), '\n');
  524.     }
  525.     cout << endl;
  526.     return x;
  527. } // end inVal(int y)
  528.  
  529. void psudoStats(long double arr[], int x)
  530. {
  531.     int sd3, sd2, sd1, i, j;
  532.  
  533.     srand (time(NULL));
  534.  
  535.     sd3 = x / 5;
  536.     sd2 = x / 27;
  537.     sd1 = x - sd2 - sd3;
  538.  
  539.     for (i = 0; i < x; i++)
  540.     {
  541.         for (j = 0; j < sd3; j++)
  542.         {
  543.         arr[i] = static_cast<long double>(9500.0 + (rand() % 500));
  544.         if (i % 2) arr[i] *= -1.0;
  545.         }
  546.  
  547.         for (j = 0; j < sd2; j++)
  548.         {
  549.         arr[i] = static_cast<long double>(6800.0 + (rand() % 2700));
  550.         if (i % 2) arr[i] *= -1.0;
  551.         }
  552.  
  553.         for (j = 0; j < sd1; j++)
  554.         {
  555.         arr[i] = static_cast<long double>((rand() % 6800));
  556.         if (i % 2) arr[i] *= -1.0;
  557.         }
  558.         arr[i] /= 100.0;
  559.     }
  560. }// end psudoStats
  561.  
  562. long double findMedian(long double arr[], int numStats)
  563. {
  564.     int i;
  565.     if (numStats % 2 == 1)
  566.     {
  567.         i = (numStats / 2);
  568.         return (arr[i]);
  569.     }
  570.     else
  571.     {
  572.         i = numStats / 2;
  573.         return ((arr[i] + arr[i-1])/2);
  574.     }
  575. }// end findMedian
  576.  
  577. long double findMean(long double arr[], int numStats)
  578. {
  579.     long double x = 0.0;
  580.     for (int i = 0; i < numStats; i++)
  581.         x += arr[i];
  582.     return (x/numStats);
  583. }// end findMean
  584.  
  585.  
  586. void exchangeSort(long double arr[], int numStats)
  587. {
  588.      int i, j;
  589.      long double temp;
  590.      for (i=0; i< (numStats -1); i++)
  591.     {
  592.           for(j = (i+1); j < numStats; j++)
  593.          {
  594.                 if (arr[i] > arr[j])
  595.                {
  596.                         temp = arr[i];
  597.                         arr[i] = arr[j];
  598.                         arr[j] = temp;
  599.                }
  600.           }
  601.           if (i % 4 == 0) cout << "\b\\";
  602.           if (i % 4 == 1) cout << "\b|";
  603.           if (i % 4 == 2) cout << "\b/";
  604.           if (i % 4 == 3) cout << "\b-";
  605.      }
  606.      cout << "\b";
  607.      return;
  608. }
  609.  
  610. int findMode(long double arr[], int numStats, modeArr mode[])
  611. {
  612.  
  613.     //  Take in sorted data.  Fall through passed array and modify modeArr struct base on results.
  614.     //      If not matching, make new struct value.
  615.     //      If     matching, change count for struct value.
  616.     //  Re-sort based on count, highest counts first.
  617.     //  Return number of records created.
  618.     //  Then main() can output modes that match the count of entry 0.
  619.    
  620.  
  621.     int returnVal = 0;
  622.  
  623.     mode[0].count = 1;
  624.     mode[0].value = arr[0];
  625.  
  626.     for (int k = 1; k < numStats; k++)
  627.     {
  628.         if (mode[returnVal].value == arr[k])
  629.             mode[returnVal].count++;
  630.         else
  631.         {
  632.             returnVal++;
  633.             mode[returnVal].count = 1;
  634.             mode[returnVal].value = arr[k];
  635.         }
  636.     }
  637.  
  638.     returnVal++;
  639.  
  640.     int i, j, temp;
  641.     long double tempLong;
  642.     for (i=0; i< (returnVal -1); i++)
  643.     {
  644.           for(j = (i+1); j < returnVal; j++)
  645.          {
  646.                 if (mode[i].count < mode[j].count)
  647.                {
  648.                         temp = mode[i].count;
  649.                         mode[i].count = mode[j].count;
  650.                         mode[j].count = temp;
  651.                         tempLong = mode[i].value;
  652.                         mode[i].value = mode[j].value;
  653.                         mode[j].value = temp;
  654.                }
  655.           }
  656.      }
  657.  
  658.  
  659.     return (returnVal);
  660. }
  661.  
  662.  
  663. float findStdDev (long double arr[], int numStats)
  664. {
  665.     long double mean, sumOfSquares = 0.0;
  666.     float stdDev;
  667.     mean = findMean(arr, numStats);
  668.     for (int i=0; i < numStats; i++)
  669.         sumOfSquares = sumOfSquares + (arr[i] * arr[i]);
  670.     stdDev = static_cast<float>(sqrt((sumOfSquares / numStats)- (mean * mean)));
  671.     return(stdDev);
  672. }
  673.  
  674. void seedStats(long double arr0[], int& i0, long double arr1[], int& i1)
  675. {
  676.     int choice = 1;
  677.     do
  678.     {
  679.         switch(choice)
  680.         {
  681.         case 0:
  682.             cout << "Returning to Load, generate, or manipulate data.\n\n";
  683.             break;
  684.         case 1:
  685.                    //         1         2         3         4         5         6         7         8
  686.                    //12345678901234567890123456789012345678901234567890123456789012345678901234567890
  687.             cout << "You have a few optons.\n"
  688.                 << "    0: Exit\n"
  689.                 << "    1: Show this list again.\n"
  690.                 << "    2: Load 13 unsorted varriables into stats array 1.\n"
  691.                 << "    3: Load 30 unsorted varriables into stats array 2.\n"
  692.                 << "    4: Load a set of 10 into each stats array.\n\n"
  693.                 << "2 and 3 are meant for testing Sort, Measures of Central Tendency, Z Ratio \n"
  694.                 << "Operations, and menu un-hiding.\n\n"
  695.                 << "4 is a set designed for Correlation Analysis and should NOT be sorted.\n\n";
  696.             break;
  697.         case 2:
  698.             arr0[0] = 7.0; arr0[1] = 9.0; arr0[5] = 22.0; arr0[3] = 25.0; arr0[4] = 8.0; arr0[7] = 13.0;
  699.             arr0[6] = 21.0; arr0[2] = 15.0; arr0[8] = 15.0; arr0[9] = 15.0; arr0[10] = 17.0; arr0[11] = 17.0; arr0[12] = 28.0;
  700.             i0 = 13;
  701.             cout << "Loaded data into stats array 1.\n\n";
  702.             break;
  703.         case 3:
  704.             arr1[0] = 15; arr1[1] = 10; arr1[2] = 20; arr1[3] = 18; arr1[4] = 18; arr1[5] = 11;  arr1[6] = 11; arr1[7] = 11;
  705.             arr1[8] = 11; arr1[9] = 12;  arr1[10] = 12; arr1[11] = 12; arr1[12] = 10; arr1[13] = 9;  arr1[14] = 9; arr1[15] = 8;
  706.             arr1[16] = 9; arr1[17] = 9;  arr1[18] = 11; arr1[19] = 11; arr1[20] = 11; arr1[21] = 15; arr1[22] = 12; arr1[23] = 12;
  707.             arr1[24] = 12; arr1[25] = 10; arr1[26] = 12; arr1[27] = 12; arr1[28] = 15; arr1[29] = 12;
  708.             i1 = 30;
  709.             cout << "Loaded data into stats array 2.\n\n";
  710.             break;
  711.         case 4:
  712.             arr0[0] = 9.0; arr0[1] = 6.0; arr0[2] = 12.0; arr0[3] = 7.0; arr0[4] = 10.0;
  713.             arr0[5] = 4.0; arr0[6] = 9.0; arr0[7] = 10.0; arr0[8] = 9.0; arr0[9] = 2.0;
  714.             i0 = 10;
  715.             arr1[0] = 6; arr1[1] = 8; arr1[2] = 2; arr1[3] = 6; arr1[4] = 10;
  716.             arr1[5] = 11; arr1[6] = 11; arr1[7] = 9; arr1[8] = 9; arr1[9] = 13;
  717.             i1 = 10;
  718.             cout << "Loaded data into both stats array 1 and 2.\n\n";
  719.             break;
  720.         }
  721.     choice = inVal(4);
  722.     }while (choice);
  723.     return;
  724. }
  725.  
  726. int whichArr()
  727. {
  728.     int wA;
  729.     while ((cout << "Which set of stats? (1 or 2) ") &&
  730.            (!(cin >> wA) || wA < 1 || wA > 2))
  731.     {
  732.         cout << "Only enter 1 or 2: ";
  733.         cin.clear();
  734.         cin.ignore(numeric_limits<streamsize>::max(), '\n');
  735.     }
  736.     cout << endl;
  737.     return (wA - 1);
  738. }
  739.  
  740. float zScore(float sD, long double mean, long double rS)
  741. {
  742.     float zS;
  743.     zS = static_cast<float>((rS - mean)/sD);
  744.     return zS;
  745. }
  746.  
  747. void zRatio2Raw(float sD, long double mean, float zR)
  748. {
  749.     float rS, zS;
  750.     zS = zRatio2Score(zR);
  751.     rS = mean + (zS * sD);
  752.     cout << "The Z Ratio " << (zR*100) << "% is a of raw score of " << rS << endl
  753.         << "which is a Z Score of " << zS << " in SD units.\n\n";
  754. }
  755.  
  756.  
  757. long double longDubIn()
  758. {
  759.     long double lD;
  760.     while ((cout << "Input value: ") &&
  761.            (!(cin >> lD) || lD < -9999999999.999999999 || lD > 9999999999.999999999))
  762.     {
  763.         cout << "Enter a numeric value between + or - 9999999999.999999999: ";
  764.         cin.clear();
  765.         cin.ignore(numeric_limits<streamsize>::max(), '\n');
  766.     }
  767.     cout << endl;
  768.     return (lD);
  769. }
  770.  
  771. float floatIn(float range)
  772. {
  773.     float f, rN = (-1.0 * range);
  774.     while ((cout << "Input value: ") &&
  775.            (!(cin >> f) || f < rN || f > range))
  776.     {
  777.         cout << "Enter a numeric value between + or - " << range << ": ";
  778.         cin.clear();
  779.         cin.ignore(numeric_limits<streamsize>::max(), '\n');
  780.     }
  781.     cout << endl;
  782.     return (f);
  783. }
  784.  
  785.  
  786. float zRatio(float zS)
  787. {
  788.     if (zS < 0) zS *= -1.0;
  789.     float zR;
  790.     int split;
  791.     if (zS < 1) split = 0;
  792.     else if (zS < 2) split = 1;
  793.     else split = 2;
  794.  
  795.     switch (split)
  796.     {
  797.     case 0:
  798.         if (zS >= 0.00 && zS < 0.01) zR = static_cast<float>(0.0000);
  799.         else if (zS >= 0.01 && zS < 0.02) zR = static_cast<float>(0.004);
  800.         else if (zS >= 0.02 && zS < 0.03) zR = static_cast<float>(0.008);
  801.         else if (zS >= 0.03 && zS < 0.04) zR = static_cast<float>(0.012);
  802.         else if (zS >= 0.04 && zS < 0.05) zR = static_cast<float>(0.016);
  803.         else if (zS >= 0.05 && zS < 0.06) zR = static_cast<float>(0.0199);
  804.         else if (zS >= 0.06 && zS < 0.07) zR = static_cast<float>(0.0239);
  805.         else if (zS >= 0.07 && zS < 0.08) zR = static_cast<float>(0.0279);
  806.         else if (zS >= 0.08 && zS < 0.09) zR = static_cast<float>(0.0319);
  807.         else if (zS >= 0.09 && zS < 0.10) zR = static_cast<float>(0.0359);
  808.         else if (zS >= 0.10 && zS < 0.11) zR = static_cast<float>(0.0398);
  809.         else if (zS >= 0.11 && zS < 0.12) zR = static_cast<float>(0.0438);
  810.         else if (zS >= 0.12 && zS < 0.13) zR = static_cast<float>(0.0478);
  811.         else if (zS >= 0.13 && zS < 0.14) zR = static_cast<float>(0.0517);
  812.         else if (zS >= 0.14 && zS < 0.15) zR = static_cast<float>(0.0557);
  813.         else if (zS >= 0.15 && zS < 0.16) zR = static_cast<float>(0.0596);
  814.         else if (zS >= 0.16 && zS < 0.17) zR = static_cast<float>(0.0636);
  815.         else if (zS >= 0.17 && zS < 0.18) zR = static_cast<float>(0.0675);
  816.         else if (zS >= 0.18 && zS < 0.19) zR = static_cast<float>(0.0714);
  817.         else if (zS >= 0.19 && zS < 0.20) zR = static_cast<float>(0.0753);
  818.         else if (zS >= 0.20 && zS < 0.21) zR = static_cast<float>(0.0793);
  819.         else if (zS >= 0.21 && zS < 0.22) zR = static_cast<float>(0.0832);
  820.         else if (zS >= 0.22 && zS < 0.23) zR = static_cast<float>(0.0871);
  821.         else if (zS >= 0.23 && zS < 0.24) zR = static_cast<float>(0.0910);
  822.         else if (zS >= 0.24 && zS < 0.25) zR = static_cast<float>(0.0948);
  823.         else if (zS >= 0.25 && zS < 0.26) zR = static_cast<float>(0.0987);
  824.         else if (zS >= 0.26 && zS < 0.27) zR = static_cast<float>(0.1026);
  825.         else if (zS >= 0.27 && zS < 0.28) zR = static_cast<float>(0.1064);
  826.         else if (zS >= 0.28 && zS < 0.29) zR = static_cast<float>(0.1103);
  827.         else if (zS >= 0.29 && zS < 0.30) zR = static_cast<float>(0.1141);
  828.         else if (zS >= 0.30 && zS < 0.31) zR = static_cast<float>(0.1179);
  829.         else if (zS >= 0.31 && zS < 0.32) zR = static_cast<float>(0.1217);
  830.         else if (zS >= 0.32 && zS < 0.33) zR = static_cast<float>(0.1255);
  831.         else if (zS >= 0.33 && zS < 0.34) zR = static_cast<float>(0.1293);
  832.         else if (zS >= 0.34 && zS < 0.35) zR = static_cast<float>(0.1331);
  833.         else if (zS >= 0.35 && zS < 0.36) zR = static_cast<float>(0.1368);
  834.         else if (zS >= 0.36 && zS < 0.37) zR = static_cast<float>(0.1406);
  835.         else if (zS >= 0.37 && zS < 0.38) zR = static_cast<float>(0.1443);
  836.         else if (zS >= 0.38 && zS < 0.39) zR = static_cast<float>(0.1480);
  837.         else if (zS >= 0.39 && zS < 0.40) zR = static_cast<float>(0.1517);
  838.         else if (zS >= 0.40 && zS < 0.41) zR = static_cast<float>(0.1554);
  839.         else if (zS >= 0.41 && zS < 0.42) zR = static_cast<float>(0.1591);
  840.         else if (zS >= 0.42 && zS < 0.43) zR = static_cast<float>(0.1628);
  841.         else if (zS >= 0.43 && zS < 0.44) zR = static_cast<float>(0.1664);
  842.         else if (zS >= 0.44 && zS < 0.45) zR = static_cast<float>(0.17);
  843.         else if (zS >= 0.45 && zS < 0.46) zR = static_cast<float>(0.1736);
  844.         else if (zS >= 0.46 && zS < 0.47) zR = static_cast<float>(0.1772);
  845.         else if (zS >= 0.47 && zS < 0.48) zR = static_cast<float>(0.1808);
  846.         else if (zS >= 0.48 && zS < 0.49) zR = static_cast<float>(0.1844);
  847.         else if (zS >= 0.49 && zS < 0.50) zR = static_cast<float>(0.1879);
  848.         else if (zS >= 0.50 && zS < 0.51) zR = static_cast<float>(0.1915);
  849.         else if (zS >= 0.51 && zS < 0.52) zR = static_cast<float>(0.195);
  850.         else if (zS >= 0.52 && zS < 0.53) zR = static_cast<float>(0.1985);
  851.         else if (zS >= 0.53 && zS < 0.54) zR = static_cast<float>(0.2019);
  852.         else if (zS >= 0.54 && zS < 0.55) zR = static_cast<float>(0.2054);
  853.         else if (zS >= 0.55 && zS < 0.56) zR = static_cast<float>(0.2088);
  854.         else if (zS >= 0.56 && zS < 0.57) zR = static_cast<float>(0.2123);
  855.         else if (zS >= 0.57 && zS < 0.58) zR = static_cast<float>(0.2157);
  856.         else if (zS >= 0.58 && zS < 0.59) zR = static_cast<float>(0.2190);
  857.         else if (zS >= 0.59 && zS < 0.60) zR = static_cast<float>(0.2224);
  858.         else if (zS >= 0.60 && zS < 0.61) zR = static_cast<float>(0.2257);
  859.         else if (zS >= 0.61 && zS < 0.62) zR = static_cast<float>(0.2291);
  860.         else if (zS >= 0.62 && zS < 0.63) zR = static_cast<float>(0.2324);
  861.         else if (zS >= 0.63 && zS < 0.64) zR = static_cast<float>(0.2357);
  862.         else if (zS >= 0.64 && zS < 0.65) zR = static_cast<float>(0.2389);
  863.         else if (zS >= 0.65 && zS < 0.66) zR = static_cast<float>(0.2422);
  864.         else if (zS >= 0.66 && zS < 0.67) zR = static_cast<float>(0.2454);
  865.         else if (zS >= 0.67 && zS < 0.68) zR = static_cast<float>(0.2486);
  866.         else if (zS >= 0.68 && zS < 0.69) zR = static_cast<float>(0.2517);
  867.         else if (zS >= 0.69 && zS < 0.70) zR = static_cast<float>(0.2549);
  868.         else if (zS >= 0.70 && zS < 0.71) zR = static_cast<float>(0.258);
  869.         else if (zS >= 0.71 && zS < 0.72) zR = static_cast<float>(0.2611);
  870.         else if (zS >= 0.72 && zS < 0.73) zR = static_cast<float>(0.2642);
  871.         else if (zS >= 0.73 && zS < 0.74) zR = static_cast<float>(0.2673);
  872.         else if (zS >= 0.74 && zS < 0.75) zR = static_cast<float>(0.2704);
  873.         else if (zS >= 0.75 && zS < 0.76) zR = static_cast<float>(0.2734);
  874.         else if (zS >= 0.76 && zS < 0.77) zR = static_cast<float>(0.2764);
  875.         else if (zS >= 0.77 && zS < 0.78) zR = static_cast<float>(0.2794);
  876.         else if (zS >= 0.78 && zS < 0.79) zR = static_cast<float>(0.2823);
  877.         else if (zS >= 0.79 && zS < 0.80) zR = static_cast<float>(0.2852);
  878.         else if (zS >= 0.80 && zS < 0.81) zR = static_cast<float>(0.2881);
  879.         else if (zS >= 0.81 && zS < 0.82) zR = static_cast<float>(0.291);
  880.         else if (zS >= 0.82 && zS < 0.83) zR = static_cast<float>(0.2939);
  881.         else if (zS >= 0.83 && zS < 0.84) zR = static_cast<float>(0.2967);
  882.         else if (zS >= 0.84 && zS < 0.85) zR = static_cast<float>(0.2995);
  883.         else if (zS >= 0.85 && zS < 0.86) zR = static_cast<float>(0.3023);
  884.         else if (zS >= 0.86 && zS < 0.87) zR = static_cast<float>(0.3051);
  885.         else if (zS >= 0.87 && zS < 0.88) zR = static_cast<float>(0.3078);
  886.         else if (zS >= 0.88 && zS < 0.89) zR = static_cast<float>(0.3106);
  887.         else if (zS >= 0.89 && zS < 0.90) zR = static_cast<float>(0.3133);
  888.         else if (zS >= 0.90 && zS < 0.91) zR = static_cast<float>(0.3159);
  889.         else if (zS >= 0.91 && zS < 0.92) zR = static_cast<float>(0.3186);
  890.         else if (zS >= 0.92 && zS < 0.93) zR = static_cast<float>(0.3212);
  891.         else if (zS >= 0.93 && zS < 0.94) zR = static_cast<float>(0.3238);
  892.         else if (zS >= 0.94 && zS < 0.95) zR = static_cast<float>(0.3264);
  893.         else if (zS >= 0.95 && zS < 0.96) zR = static_cast<float>(0.3289);
  894.         else if (zS >= 0.96 && zS < 0.97) zR = static_cast<float>(0.3315);
  895.         else if (zS >= 0.97 && zS < 0.98) zR = static_cast<float>(0.334);
  896.         else if (zS >= 0.98 && zS < 0.99) zR = static_cast<float>(0.3365);
  897.         else zR = static_cast<float>(0.3389);
  898.     break;
  899.     case 1:
  900.         if (zS >= 1.00 && zS < 1.01) zR = static_cast<float>(0.3413);
  901.         else if (zS >= 1.01 && zS < 1.02) zR = static_cast<float>(0.3438);
  902.         else if (zS >= 1.02 && zS < 1.03) zR = static_cast<float>(0.3461);
  903.         else if (zS >= 1.03 && zS < 1.04) zR = static_cast<float>(0.3485);
  904.         else if (zS >= 1.04 && zS < 1.05) zR = static_cast<float>(0.3508);
  905.         else if (zS >= 1.05 && zS < 1.06) zR = static_cast<float>(0.3531);
  906.         else if (zS >= 1.06 && zS < 1.07) zR = static_cast<float>(0.3554);
  907.         else if (zS >= 1.07 && zS < 1.08) zR = static_cast<float>(0.3577);
  908.         else if (zS >= 1.08 && zS < 1.09) zR = static_cast<float>(0.3599);
  909.         else if (zS >= 1.09 && zS < 1.10) zR = static_cast<float>(0.3621);
  910.         else if (zS >= 1.10 && zS < 1.11) zR = static_cast<float>(0.3643);
  911.         else if (zS >= 1.11 && zS < 1.12) zR = static_cast<float>(0.3665);
  912.         else if (zS >= 1.12 && zS < 1.13) zR = static_cast<float>(0.3686);
  913.         else if (zS >= 1.13 && zS < 1.14) zR = static_cast<float>(0.3708);
  914.         else if (zS >= 1.14 && zS < 1.15) zR = static_cast<float>(0.3729);
  915.         else if (zS >= 1.15 && zS < 1.16) zR = static_cast<float>(0.3749);
  916.         else if (zS >= 1.16 && zS < 1.17) zR = static_cast<float>(0.377);
  917.         else if (zS >= 1.17 && zS < 1.18) zR = static_cast<float>(0.379);
  918.         else if (zS >= 1.18 && zS < 1.19) zR = static_cast<float>(0.381);
  919.         else if (zS >= 1.19 && zS < 1.20) zR = static_cast<float>(0.383);
  920.         else if (zS >= 1.20 && zS < 1.21) zR = static_cast<float>(0.3849);
  921.         else if (zS >= 1.21 && zS < 1.22) zR = static_cast<float>(0.3869);
  922.         else if (zS >= 1.22 && zS < 1.23) zR = static_cast<float>(0.3888);
  923.         else if (zS >= 1.23 && zS < 1.24) zR = static_cast<float>(0.3907);
  924.         else if (zS >= 1.24 && zS < 1.25) zR = static_cast<float>(0.3925);
  925.         else if (zS >= 1.25 && zS < 1.26) zR = static_cast<float>(0.3944);
  926.         else if (zS >= 1.26 && zS < 1.27) zR = static_cast<float>(0.3962);
  927.         else if (zS >= 1.27 && zS < 1.28) zR = static_cast<float>(0.398);
  928.         else if (zS >= 1.28 && zS < 1.29) zR = static_cast<float>(0.3997);
  929.         else if (zS >= 1.29 && zS < 1.30) zR = static_cast<float>(0.4015);
  930.         else if (zS >= 1.30 && zS < 1.31) zR = static_cast<float>(0.4032);
  931.         else if (zS >= 1.31 && zS < 1.32) zR = static_cast<float>(0.4049);
  932.         else if (zS >= 1.32 && zS < 1.33) zR = static_cast<float>(0.4066);
  933.         else if (zS >= 1.33 && zS < 1.34) zR = static_cast<float>(0.4082);
  934.         else if (zS >= 1.34 && zS < 1.35) zR = static_cast<float>(0.4099);
  935.         else if (zS >= 1.35 && zS < 1.36) zR = static_cast<float>(0.4115);
  936.         else if (zS >= 1.36 && zS < 1.37) zR = static_cast<float>(0.4131);
  937.         else if (zS >= 1.37 && zS < 1.38) zR = static_cast<float>(0.4147);
  938.         else if (zS >= 1.38 && zS < 1.39) zR = static_cast<float>(0.4162);
  939.         else if (zS >= 1.39 && zS < 1.40) zR = static_cast<float>(0.4177);
  940.         else if (zS >= 1.40 && zS < 1.41) zR = static_cast<float>(0.4192);
  941.         else if (zS >= 1.41 && zS < 1.42) zR = static_cast<float>(0.4207);
  942.         else if (zS >= 1.42 && zS < 1.43) zR = static_cast<float>(0.4222);
  943.         else if (zS >= 1.43 && zS < 1.44) zR = static_cast<float>(0.4236);
  944.         else if (zS >= 1.44 && zS < 1.45) zR = static_cast<float>(0.4251);
  945.         else if (zS >= 1.45 && zS < 1.46) zR = static_cast<float>(0.4265);
  946.         else if (zS >= 1.46 && zS < 1.47) zR = static_cast<float>(0.4279);
  947.         else if (zS >= 1.47 && zS < 1.48) zR = static_cast<float>(0.4292);
  948.         else if (zS >= 1.48 && zS < 1.49) zR = static_cast<float>(0.4306);
  949.         else if (zS >= 1.49 && zS < 1.50) zR = static_cast<float>(0.4319);
  950.         else if (zS >= 1.50 && zS < 1.51) zR = static_cast<float>(0.4332);
  951.         else if (zS >= 1.51 && zS < 1.52) zR = static_cast<float>(0.4345);
  952.         else if (zS >= 1.52 && zS < 1.53) zR = static_cast<float>(0.4357);
  953.         else if (zS >= 1.53 && zS < 1.54) zR = static_cast<float>(0.4370);
  954.         else if (zS >= 1.54 && zS < 1.55) zR = static_cast<float>(0.4382);
  955.         else if (zS >= 1.55 && zS < 1.56) zR = static_cast<float>(0.4394);
  956.         else if (zS >= 1.56 && zS < 1.57) zR = static_cast<float>(0.4406);
  957.         else if (zS >= 1.57 && zS < 1.58) zR = static_cast<float>(0.4418);
  958.         else if (zS >= 1.58 && zS < 1.59) zR = static_cast<float>(0.4429);
  959.         else if (zS >= 1.59 && zS < 1.60) zR = static_cast<float>(0.4441);
  960.         else if (zS >= 1.60 && zS < 1.61) zR = static_cast<float>(0.4452);
  961.         else if (zS >= 1.61 && zS < 1.62) zR = static_cast<float>(0.4463);
  962.         else if (zS >= 1.62 && zS < 1.63) zR = static_cast<float>(0.4474);
  963.         else if (zS >= 1.63 && zS < 1.64) zR = static_cast<float>(0.4484);
  964.         else if (zS >= 1.64 && zS < 1.65) zR = static_cast<float>(0.4495);
  965.         else if (zS >= 1.65 && zS < 1.66) zR = static_cast<float>(0.4505);
  966.         else if (zS >= 1.66 && zS < 1.67) zR = static_cast<float>(0.4515);
  967.         else if (zS >= 1.67 && zS < 1.68) zR = static_cast<float>(0.4525);
  968.         else if (zS >= 1.68 && zS < 1.69) zR = static_cast<float>(0.4535);
  969.         else if (zS >= 1.69 && zS < 1.70) zR = static_cast<float>(0.4545);
  970.         else if (zS >= 1.70 && zS < 1.71) zR = static_cast<float>(0.4554);
  971.         else if (zS >= 1.71 && zS < 1.72) zR = static_cast<float>(0.4564);
  972.         else if (zS >= 1.72 && zS < 1.73) zR = static_cast<float>(0.4573);
  973.         else if (zS >= 1.73 && zS < 1.74) zR = static_cast<float>(0.4582);
  974.         else if (zS >= 1.74 && zS < 1.75) zR = static_cast<float>(0.4591);
  975.         else if (zS >= 1.75 && zS < 1.76) zR = static_cast<float>(0.4599);
  976.         else if (zS >= 1.76 && zS < 1.77) zR = static_cast<float>(0.4608);
  977.         else if (zS >= 1.77 && zS < 1.78) zR = static_cast<float>(0.4616);
  978.         else if (zS >= 1.78 && zS < 1.79) zR = static_cast<float>(0.4625);
  979.         else if (zS >= 1.79 && zS < 1.80) zR = static_cast<float>(0.4633);
  980.         else if (zS >= 1.80 && zS < 1.81) zR = static_cast<float>(0.4641);
  981.         else if (zS >= 1.81 && zS < 1.82) zR = static_cast<float>(0.4649);
  982.         else if (zS >= 1.82 && zS < 1.83) zR = static_cast<float>(0.4656);
  983.         else if (zS >= 1.83 && zS < 1.84) zR = static_cast<float>(0.4664);
  984.         else if (zS >= 1.84 && zS < 1.85) zR = static_cast<float>(0.4671);
  985.         else if (zS >= 1.85 && zS < 1.86) zR = static_cast<float>(0.4678);
  986.         else if (zS >= 1.86 && zS < 1.87) zR = static_cast<float>(0.4686);
  987.         else if (zS >= 1.87 && zS < 1.88) zR = static_cast<float>(0.4693);
  988.         else if (zS >= 1.88 && zS < 1.89) zR = static_cast<float>(0.4699);
  989.         else if (zS >= 1.89 && zS < 1.90) zR = static_cast<float>(0.4706);
  990.         else if (zS >= 1.90 && zS < 1.91) zR = static_cast<float>(0.4713);
  991.         else if (zS >= 1.91 && zS < 1.92) zR = static_cast<float>(0.4719);
  992.         else if (zS >= 1.92 && zS < 1.93) zR = static_cast<float>(0.4726);
  993.         else if (zS >= 1.93 && zS < 1.94) zR = static_cast<float>(0.4732);
  994.         else if (zS >= 1.94 && zS < 1.95) zR = static_cast<float>(0.4738);
  995.         else if (zS >= 1.95 && zS < 1.96) zR = static_cast<float>(0.4744);
  996.         else if (zS >= 1.96 && zS < 1.97) zR = static_cast<float>(0.4750);
  997.         else if (zS >= 1.97 && zS < 1.98) zR = static_cast<float>(0.4756);
  998.         else if (zS >= 1.98 && zS < 1.99) zR = static_cast<float>(0.4761);
  999.         else zR = static_cast<float>(0.4767);
  1000.     break;
  1001.     case 2:
  1002.         if (zS >= 2.00 && zS < 2.01) zR = static_cast<float>(0.4772);
  1003.         else if (zS >= 2.01 && zS < 2.02) zR = static_cast<float>(0.4778);
  1004.         else if (zS >= 2.02 && zS < 2.03) zR = static_cast<float>(0.4783);
  1005.         else if (zS >= 2.03 && zS < 2.04) zR = static_cast<float>(0.4788);
  1006.         else if (zS >= 2.04 && zS < 2.05) zR = static_cast<float>(0.4793);
  1007.         else if (zS >= 2.05 && zS < 2.06) zR = static_cast<float>(0.4798);
  1008.         else if (zS >= 2.06 && zS < 2.07) zR = static_cast<float>(0.4803);
  1009.         else if (zS >= 2.07 && zS < 2.08) zR = static_cast<float>(0.4808);
  1010.         else if (zS >= 2.08 && zS < 2.09) zR = static_cast<float>(0.4812);
  1011.         else if (zS >= 2.09 && zS < 2.10) zR = static_cast<float>(0.4817);
  1012.         else if (zS >= 2.10 && zS < 2.11) zR = static_cast<float>(0.4821);
  1013.         else if (zS >= 2.11 && zS < 2.12) zR = static_cast<float>(0.4826);
  1014.         else if (zS >= 2.12 && zS < 2.13) zR = static_cast<float>(0.4830);
  1015.         else if (zS >= 2.13 && zS < 2.14) zR = static_cast<float>(0.4834);
  1016.         else if (zS >= 2.14 && zS < 2.15) zR = static_cast<float>(0.4838);
  1017.         else if (zS >= 2.15 && zS < 2.16) zR = static_cast<float>(0.4842);
  1018.         else if (zS >= 2.16 && zS < 2.17) zR = static_cast<float>(0.4846);
  1019.         else if (zS >= 2.17 && zS < 2.18) zR = static_cast<float>(0.4850);
  1020.         else if (zS >= 2.18 && zS < 2.19) zR = static_cast<float>(0.4854);
  1021.         else if (zS >= 2.19 && zS < 2.20) zR = static_cast<float>(0.4857);
  1022.         else if (zS >= 2.20 && zS < 2.21) zR = static_cast<float>(0.4861);
  1023.         else if (zS >= 2.21 && zS < 2.22) zR = static_cast<float>(0.4864);
  1024.         else if (zS >= 2.22 && zS < 2.23) zR = static_cast<float>(0.4868);
  1025.         else if (zS >= 2.23 && zS < 2.24) zR = static_cast<float>(0.4871);
  1026.         else if (zS >= 2.24 && zS < 2.25) zR = static_cast<float>(0.4875);
  1027.         else if (zS >= 2.25 && zS < 2.26) zR = static_cast<float>(0.4878);
  1028.         else if (zS >= 2.26 && zS < 2.27) zR = static_cast<float>(0.4881);
  1029.         else if (zS >= 2.27 && zS < 2.28) zR = static_cast<float>(0.4884);
  1030.         else if (zS >= 2.28 && zS < 2.29) zR = static_cast<float>(0.4887);
  1031.         else if (zS >= 2.29 && zS < 2.30) zR = static_cast<float>(0.4890);
  1032.         else if (zS >= 2.30 && zS < 2.31) zR = static_cast<float>(0.4893);
  1033.         else if (zS >= 2.31 && zS < 2.32) zR = static_cast<float>(0.4896);
  1034.         else if (zS >= 2.32 && zS < 2.33) zR = static_cast<float>(0.4898);
  1035.         else if (zS >= 2.33 && zS < 2.34) zR = static_cast<float>(0.4901);
  1036.         else if (zS >= 2.34 && zS < 2.35) zR = static_cast<float>(0.4904);
  1037.         else if (zS >= 2.35 && zS < 2.36) zR = static_cast<float>(0.4906);
  1038.         else if (zS >= 2.36 && zS < 2.37) zR = static_cast<float>(0.4909);
  1039.         else if (zS >= 2.37 && zS < 2.38) zR = static_cast<float>(0.4911);
  1040.         else if (zS >= 2.38 && zS < 2.39) zR = static_cast<float>(0.4913);
  1041.         else if (zS >= 2.39 && zS < 2.40) zR = static_cast<float>(0.4916);
  1042.         else if (zS >= 2.40 && zS < 2.41) zR = static_cast<float>(0.4918);
  1043.         else if (zS >= 2.41 && zS < 2.42) zR = static_cast<float>(0.492);
  1044.         else if (zS >= 2.42 && zS < 2.43) zR = static_cast<float>(0.4922);
  1045.         else if (zS >= 2.43 && zS < 2.44) zR = static_cast<float>(0.4925);
  1046.         else if (zS >= 2.44 && zS < 2.45) zR = static_cast<float>(0.4927);
  1047.         else if (zS >= 2.45 && zS < 2.46) zR = static_cast<float>(0.4929);
  1048.         else if (zS >= 2.46 && zS < 2.47) zR = static_cast<float>(0.4931);
  1049.         else if (zS >= 2.47 && zS < 2.48) zR = static_cast<float>(0.4932);
  1050.         else if (zS >= 2.48 && zS < 2.49) zR = static_cast<float>(0.4934);
  1051.         else if (zS >= 2.49 && zS < 2.50) zR = static_cast<float>(0.4936);
  1052.         else if (zS >= 2.50 && zS < 2.51) zR = static_cast<float>(0.4938);
  1053.         else if (zS >= 2.51 && zS < 2.52) zR = static_cast<float>(0.494);
  1054.         else if (zS >= 2.52 && zS < 2.53) zR = static_cast<float>(0.4941);
  1055.         else if (zS >= 2.53 && zS < 2.54) zR = static_cast<float>(0.4943);
  1056.         else if (zS >= 2.54 && zS < 2.55) zR = static_cast<float>(0.4945);
  1057.         else if (zS >= 2.55 && zS < 2.56) zR = static_cast<float>(0.4946);
  1058.         else if (zS >= 2.56 && zS < 2.57) zR = static_cast<float>(0.4948);
  1059.         else if (zS >= 2.57 && zS < 2.58) zR = static_cast<float>(0.4949);
  1060.         else if (zS >= 2.58 && zS < 2.59) zR = static_cast<float>(0.4951);
  1061.         else if (zS >= 2.59 && zS < 2.60) zR = static_cast<float>(0.4952);
  1062.         else if (zS >= 2.60 && zS < 2.61) zR = static_cast<float>(0.4953);
  1063.         else if (zS >= 2.61 && zS < 2.62) zR = static_cast<float>(0.4955);
  1064.         else if (zS >= 2.62 && zS < 2.63) zR = static_cast<float>(0.4956);
  1065.         else if (zS >= 2.63 && zS < 2.64) zR = static_cast<float>(0.4957);
  1066.         else if (zS >= 2.64 && zS < 2.65) zR = static_cast<float>(0.4959);
  1067.         else if (zS >= 2.65 && zS < 2.66) zR = static_cast<float>(0.4960);
  1068.         else if (zS >= 2.66 && zS < 2.67) zR = static_cast<float>(0.4961);
  1069.         else if (zS >= 2.67 && zS < 2.68) zR = static_cast<float>(0.4962);
  1070.         else if (zS >= 2.68 && zS < 2.69) zR = static_cast<float>(0.4963);
  1071.         else if (zS >= 2.69 && zS < 2.70) zR = static_cast<float>(0.4964);
  1072.         else if (zS >= 2.70 && zS < 2.71) zR = static_cast<float>(0.4965);
  1073.         else if (zS >= 2.71 && zS < 2.72) zR = static_cast<float>(0.4966);
  1074.         else if (zS >= 2.72 && zS < 2.73) zR = static_cast<float>(0.4967);
  1075.         else if (zS >= 2.73 && zS < 2.74) zR = static_cast<float>(0.4968);
  1076.         else if (zS >= 2.74 && zS < 2.75) zR = static_cast<float>(0.4969);
  1077.         else if (zS >= 2.75 && zS < 2.76) zR = static_cast<float>(0.497);
  1078.         else if (zS >= 2.76 && zS < 2.77) zR = static_cast<float>(0.4971);
  1079.         else if (zS >= 2.77 && zS < 2.78) zR = static_cast<float>(0.4972);
  1080.         else if (zS >= 2.78 && zS < 2.79) zR = static_cast<float>(0.4973);
  1081.         else if (zS >= 2.79 && zS < 2.81) zR = static_cast<float>(0.4974);
  1082.         else if (zS >= 2.81 && zS < 2.82) zR = static_cast<float>(0.4975);
  1083.         else if (zS >= 2.82 && zS < 2.83) zR = static_cast<float>(0.4976);
  1084.         else if (zS >= 2.83 && zS < 2.85) zR = static_cast<float>(0.4977);
  1085.         else if (zS >= 2.85 && zS < 2.86) zR = static_cast<float>(0.4978);
  1086.         else if (zS >= 2.86 && zS < 2.88) zR = static_cast<float>(0.4979);
  1087.         else if (zS >= 2.88 && zS < 2.89) zR = static_cast<float>(0.498);
  1088.         else if (zS >= 2.89 && zS < 2.91) zR = static_cast<float>(0.4981);
  1089.         else if (zS >= 2.91 && zS < 2.93) zR = static_cast<float>(0.4982);
  1090.         else if (zS >= 2.93 && zS < 2.94) zR = static_cast<float>(0.4983);
  1091.         else if (zS >= 2.94 && zS < 2.96) zR = static_cast<float>(0.4984);
  1092.         else if (zS >= 2.96 && zS < 2.98) zR = static_cast<float>(0.4985);
  1093.         else if (zS >= 2.98 && zS < 3.00) zR = static_cast<float>(0.4986);
  1094.         else if (zS >= 3.00 && zS < 3.03) zR = static_cast<float>(0.4987);
  1095.         else if (zS >= 3.03 && zS < 3.05) zR = static_cast<float>(0.4988);
  1096.         else if (zS >= 3.05 && zS < 3.08) zR = static_cast<float>(0.4989);
  1097.         else if (zS >= 3.08 && zS < 3.11) zR = static_cast<float>(0.4990);
  1098.         else if (zS >= 3.11 && zS < 3.15) zR = static_cast<float>(0.4991);
  1099.         else if (zS >= 3.15 && zS < 3.18) zR = static_cast<float>(0.4992);
  1100.         else if (zS >= 3.18 && zS < 3.22) zR = static_cast<float>(0.4993);
  1101.         else if (zS >= 3.22 && zS < 3.27) zR = static_cast<float>(0.4994);
  1102.         else if (zS >= 3.27 && zS < 3.33) zR = static_cast<float>(0.4995);
  1103.         else if (zS >= 3.33 && zS < 3.39) zR = static_cast<float>(0.4996);
  1104.         else if (zS >= 3.39 && zS < 3.49) zR = static_cast<float>(0.4997);
  1105.         else if (zS >= 3.49 && zS < 3.70) zR = static_cast<float>(0.4998);
  1106.         else if (zS >= 3.70) zR = static_cast<float>(0.4999);
  1107.     }
  1108.     return (zR);
  1109. }//zRatio(float zS)
  1110.  
  1111. float zRatio2Score(float zR)
  1112. {
  1113.     float signFlip;
  1114.     if (zR < 0.0) signFlip = -1.0; else signFlip = 1.0;
  1115.     zR *= signFlip;
  1116.     float zS;
  1117.     int split;
  1118.     if (zR < 0.3413) split = 0;
  1119.     else if (zR < 0.4772) split = 1;
  1120.     else split = 2;
  1121.  
  1122.     switch (split)
  1123.     {
  1124.     case 0:
  1125.         if (zR >= 0 && zR < 0.004 ) zS = static_cast<float>( 0 );
  1126.         else if (zR >= 0.004 && zR < 0.008 ) zS = static_cast<float>( 0.01 );
  1127.         else if (zR >= 0.008 && zR < 0.012 ) zS = static_cast<float>( 0.02 );
  1128.         else if (zR >= 0.012 && zR < 0.016 ) zS = static_cast<float>( 0.03 );
  1129.         else if (zR >= 0.016 && zR < 0.0199 ) zS = static_cast<float>( 0.04 );
  1130.         else if (zR >= 0.0199 && zR < 0.0239 ) zS = static_cast<float>( 0.05 );
  1131.         else if (zR >= 0.0239 && zR < 0.0279 ) zS = static_cast<float>( 0.06 );
  1132.         else if (zR >= 0.0279 && zR < 0.0319 ) zS = static_cast<float>( 0.07 );
  1133.         else if (zR >= 0.0319 && zR < 0.0359 ) zS = static_cast<float>( 0.08 );
  1134.         else if (zR >= 0.0359 && zR < 0.0398 ) zS = static_cast<float>( 0.09 );
  1135.         else if (zR >= 0.0398 && zR < 0.0438 ) zS = static_cast<float>( 0.1 );
  1136.         else if (zR >= 0.0438 && zR < 0.0478 ) zS = static_cast<float>( 0.11 );
  1137.         else if (zR >= 0.0478 && zR < 0.0517 ) zS = static_cast<float>( 0.12 );
  1138.         else if (zR >= 0.0517 && zR < 0.0557 ) zS = static_cast<float>( 0.13 );
  1139.         else if (zR >= 0.0557 && zR < 0.0596 ) zS = static_cast<float>( 0.14 );
  1140.         else if (zR >= 0.0596 && zR < 0.0636 ) zS = static_cast<float>( 0.15 );
  1141.         else if (zR >= 0.0636 && zR < 0.0675 ) zS = static_cast<float>( 0.16 );
  1142.         else if (zR >= 0.0675 && zR < 0.0714 ) zS = static_cast<float>( 0.17 );
  1143.         else if (zR >= 0.0714 && zR < 0.0753 ) zS = static_cast<float>( 0.18 );
  1144.         else if (zR >= 0.0753 && zR < 0.0793 ) zS = static_cast<float>( 0.19 );
  1145.         else if (zR >= 0.0793 && zR < 0.0832 ) zS = static_cast<float>( 0.2 );
  1146.         else if (zR >= 0.0832 && zR < 0.0871 ) zS = static_cast<float>( 0.21 );
  1147.         else if (zR >= 0.0871 && zR < 0.091 ) zS = static_cast<float>( 0.22 );
  1148.         else if (zR >= 0.091 && zR < 0.0948 ) zS = static_cast<float>( 0.23 );
  1149.         else if (zR >= 0.0948 && zR < 0.0987 ) zS = static_cast<float>( 0.24 );
  1150.         else if (zR >= 0.0987 && zR < 0.1026 ) zS = static_cast<float>( 0.25 );
  1151.         else if (zR >= 0.1026 && zR < 0.1064 ) zS = static_cast<float>( 0.26 );
  1152.         else if (zR >= 0.1064 && zR < 0.1103 ) zS = static_cast<float>( 0.27 );
  1153.         else if (zR >= 0.1103 && zR < 0.1141 ) zS = static_cast<float>( 0.28 );
  1154.         else if (zR >= 0.1141 && zR < 0.1179 ) zS = static_cast<float>( 0.29 );
  1155.         else if (zR >= 0.1179 && zR < 0.1217 ) zS = static_cast<float>( 0.3 );
  1156.         else if (zR >= 0.1217 && zR < 0.1255 ) zS = static_cast<float>( 0.31 );
  1157.         else if (zR >= 0.1255 && zR < 0.1293 ) zS = static_cast<float>( 0.32 );
  1158.         else if (zR >= 0.1293 && zR < 0.1331 ) zS = static_cast<float>( 0.33 );
  1159.         else if (zR >= 0.1331 && zR < 0.1368 ) zS = static_cast<float>( 0.34 );
  1160.         else if (zR >= 0.1368 && zR < 0.1406 ) zS = static_cast<float>( 0.35 );
  1161.         else if (zR >= 0.1406 && zR < 0.1443 ) zS = static_cast<float>( 0.36 );
  1162.         else if (zR >= 0.1443 && zR < 0.148 ) zS = static_cast<float>( 0.37 );
  1163.         else if (zR >= 0.148 && zR < 0.1517 ) zS = static_cast<float>( 0.38 );
  1164.         else if (zR >= 0.1517 && zR < 0.1554 ) zS = static_cast<float>( 0.39 );
  1165.         else if (zR >= 0.1554 && zR < 0.1591 ) zS = static_cast<float>( 0.4 );
  1166.         else if (zR >= 0.1591 && zR < 0.1628 ) zS = static_cast<float>( 0.41 );
  1167.         else if (zR >= 0.1628 && zR < 0.1664 ) zS = static_cast<float>( 0.42 );
  1168.         else if (zR >= 0.1664 && zR < 0.17 ) zS = static_cast<float>( 0.43 );
  1169.         else if (zR >= 0.17 && zR < 0.1736 ) zS = static_cast<float>( 0.44 );
  1170.         else if (zR >= 0.1736 && zR < 0.1772 ) zS = static_cast<float>( 0.45 );
  1171.         else if (zR >= 0.1772 && zR < 0.1808 ) zS = static_cast<float>( 0.46 );
  1172.         else if (zR >= 0.1808 && zR < 0.1844 ) zS = static_cast<float>( 0.47 );
  1173.         else if (zR >= 0.1844 && zR < 0.1879 ) zS = static_cast<float>( 0.48 );
  1174.         else if (zR >= 0.1879 && zR < 0.1915 ) zS = static_cast<float>( 0.49 );
  1175.         else if (zR >= 0.1915 && zR < 0.195 ) zS = static_cast<float>( 0.5 );
  1176.         else if (zR >= 0.195 && zR < 0.1985 ) zS = static_cast<float>( 0.51 );
  1177.         else if (zR >= 0.1985 && zR < 0.2019 ) zS = static_cast<float>( 0.52 );
  1178.         else if (zR >= 0.2019 && zR < 0.2054 ) zS = static_cast<float>( 0.53 );
  1179.         else if (zR >= 0.2054 && zR < 0.2088 ) zS = static_cast<float>( 0.54 );
  1180.         else if (zR >= 0.2088 && zR < 0.2123 ) zS = static_cast<float>( 0.55 );
  1181.         else if (zR >= 0.2123 && zR < 0.2157 ) zS = static_cast<float>( 0.56 );
  1182.         else if (zR >= 0.2157 && zR < 0.219 ) zS = static_cast<float>( 0.57 );
  1183.         else if (zR >= 0.219 && zR < 0.2224 ) zS = static_cast<float>( 0.58 );
  1184.         else if (zR >= 0.2224 && zR < 0.2257 ) zS = static_cast<float>( 0.59 );
  1185.         else if (zR >= 0.2257 && zR < 0.2291 ) zS = static_cast<float>( 0.6 );
  1186.         else if (zR >= 0.2291 && zR < 0.2324 ) zS = static_cast<float>( 0.61 );
  1187.         else if (zR >= 0.2324 && zR < 0.2357 ) zS = static_cast<float>( 0.62 );
  1188.         else if (zR >= 0.2357 && zR < 0.2389 ) zS = static_cast<float>( 0.63 );
  1189.         else if (zR >= 0.2389 && zR < 0.2422 ) zS = static_cast<float>( 0.64 );
  1190.         else if (zR >= 0.2422 && zR < 0.2454 ) zS = static_cast<float>( 0.65 );
  1191.         else if (zR >= 0.2454 && zR < 0.2486 ) zS = static_cast<float>( 0.66 );
  1192.         else if (zR >= 0.2486 && zR < 0.2517 ) zS = static_cast<float>( 0.67 );
  1193.         else if (zR >= 0.2517 && zR < 0.2549 ) zS = static_cast<float>( 0.68 );
  1194.         else if (zR >= 0.2549 && zR < 0.258 ) zS = static_cast<float>( 0.69 );
  1195.         else if (zR >= 0.258 && zR < 0.2611 ) zS = static_cast<float>( 0.7 );
  1196.         else if (zR >= 0.2611 && zR < 0.2642 ) zS = static_cast<float>( 0.71 );
  1197.         else if (zR >= 0.2642 && zR < 0.2673 ) zS = static_cast<float>( 0.72 );
  1198.         else if (zR >= 0.2673 && zR < 0.2704 ) zS = static_cast<float>( 0.73 );
  1199.         else if (zR >= 0.2704 && zR < 0.2734 ) zS = static_cast<float>( 0.74 );
  1200.         else if (zR >= 0.2734 && zR < 0.2764 ) zS = static_cast<float>( 0.75 );
  1201.         else if (zR >= 0.2764 && zR < 0.2794 ) zS = static_cast<float>( 0.76 );
  1202.         else if (zR >= 0.2794 && zR < 0.2823 ) zS = static_cast<float>( 0.77 );
  1203.         else if (zR >= 0.2823 && zR < 0.2852 ) zS = static_cast<float>( 0.78 );
  1204.         else if (zR >= 0.2852 && zR < 0.2881 ) zS = static_cast<float>( 0.79 );
  1205.         else if (zR >= 0.2881 && zR < 0.291 ) zS = static_cast<float>( 0.8 );
  1206.         else if (zR >= 0.291 && zR < 0.2939 ) zS = static_cast<float>( 0.81 );
  1207.         else if (zR >= 0.2939 && zR < 0.2967 ) zS = static_cast<float>( 0.82 );
  1208.         else if (zR >= 0.2967 && zR < 0.2995 ) zS = static_cast<float>( 0.83 );
  1209.         else if (zR >= 0.2995 && zR < 0.3023 ) zS = static_cast<float>( 0.84 );
  1210.         else if (zR >= 0.3023 && zR < 0.3051 ) zS = static_cast<float>( 0.85 );
  1211.         else if (zR >= 0.3051 && zR < 0.3078 ) zS = static_cast<float>( 0.86 );
  1212.         else if (zR >= 0.3078 && zR < 0.3106 ) zS = static_cast<float>( 0.87 );
  1213.         else if (zR >= 0.3106 && zR < 0.3133 ) zS = static_cast<float>( 0.88 );
  1214.         else if (zR >= 0.3133 && zR < 0.3159 ) zS = static_cast<float>( 0.89 );
  1215.         else if (zR >= 0.3159 && zR < 0.3186 ) zS = static_cast<float>( 0.9 );
  1216.         else if (zR >= 0.3186 && zR < 0.3212 ) zS = static_cast<float>( 0.91 );
  1217.         else if (zR >= 0.3212 && zR < 0.3238 ) zS = static_cast<float>( 0.92 );
  1218.         else if (zR >= 0.3238 && zR < 0.3264 ) zS = static_cast<float>( 0.93 );
  1219.         else if (zR >= 0.3264 && zR < 0.3289 ) zS = static_cast<float>( 0.94 );
  1220.         else if (zR >= 0.3289 && zR < 0.3315 ) zS = static_cast<float>( 0.95 );
  1221.         else if (zR >= 0.3315 && zR < 0.334 ) zS = static_cast<float>( 0.96 );
  1222.         else if (zR >= 0.334 && zR < 0.3365 ) zS = static_cast<float>( 0.97 );
  1223.         else if (zR >= 0.3365 && zR < 0.3389 ) zS = static_cast<float>( 0.98 );
  1224.         else zS = static_cast<float>( 0.99 );
  1225.  break;  
  1226.  case 1:  
  1227.  if (zR >= 0.3413 && zR < 0.3438 ) zS = static_cast<float>( 1 );
  1228.         else if (zR >= 0.3438 && zR < 0.3461 ) zS = static_cast<float>( 1.01 );
  1229.         else if (zR >= 0.3461 && zR < 0.3485 ) zS = static_cast<float>( 1.02 );
  1230.         else if (zR >= 0.3485 && zR < 0.3508 ) zS = static_cast<float>( 1.03 );
  1231.         else if (zR >= 0.3508 && zR < 0.3531 ) zS = static_cast<float>( 1.04 );
  1232.         else if (zR >= 0.3531 && zR < 0.3554 ) zS = static_cast<float>( 1.05 );
  1233.         else if (zR >= 0.3554 && zR < 0.3577 ) zS = static_cast<float>( 1.06 );
  1234.         else if (zR >= 0.3577 && zR < 0.3599 ) zS = static_cast<float>( 1.07 );
  1235.         else if (zR >= 0.3599 && zR < 0.3621 ) zS = static_cast<float>( 1.08 );
  1236.         else if (zR >= 0.3621 && zR < 0.3643 ) zS = static_cast<float>( 1.09 );
  1237.         else if (zR >= 0.3643 && zR < 0.3665 ) zS = static_cast<float>( 1.1 );
  1238.         else if (zR >= 0.3665 && zR < 0.3686 ) zS = static_cast<float>( 1.11 );
  1239.         else if (zR >= 0.3686 && zR < 0.3708 ) zS = static_cast<float>( 1.12 );
  1240.         else if (zR >= 0.3708 && zR < 0.3729 ) zS = static_cast<float>( 1.13 );
  1241.         else if (zR >= 0.3729 && zR < 0.3749 ) zS = static_cast<float>( 1.14 );
  1242.         else if (zR >= 0.3749 && zR < 0.377 ) zS = static_cast<float>( 1.15 );
  1243.         else if (zR >= 0.377 && zR < 0.379 ) zS = static_cast<float>( 1.16 );
  1244.         else if (zR >= 0.379 && zR < 0.381 ) zS = static_cast<float>( 1.17 );
  1245.         else if (zR >= 0.381 && zR < 0.383 ) zS = static_cast<float>( 1.18 );
  1246.         else if (zR >= 0.383 && zR < 0.3849 ) zS = static_cast<float>( 1.19 );
  1247.         else if (zR >= 0.3849 && zR < 0.3869 ) zS = static_cast<float>( 1.2 );
  1248.         else if (zR >= 0.3869 && zR < 0.3888 ) zS = static_cast<float>( 1.21 );
  1249.         else if (zR >= 0.3888 && zR < 0.3907 ) zS = static_cast<float>( 1.22 );
  1250.         else if (zR >= 0.3907 && zR < 0.3925 ) zS = static_cast<float>( 1.23 );
  1251.         else if (zR >= 0.3925 && zR < 0.3944 ) zS = static_cast<float>( 1.24 );
  1252.         else if (zR >= 0.3944 && zR < 0.3962 ) zS = static_cast<float>( 1.25 );
  1253.         else if (zR >= 0.3962 && zR < 0.398 ) zS = static_cast<float>( 1.26 );
  1254.         else if (zR >= 0.398 && zR < 0.3997 ) zS = static_cast<float>( 1.27 );
  1255.         else if (zR >= 0.3997 && zR < 0.4015 ) zS = static_cast<float>( 1.28 );
  1256.         else if (zR >= 0.4015 && zR < 0.4032 ) zS = static_cast<float>( 1.29 );
  1257.         else if (zR >= 0.4032 && zR < 0.4049 ) zS = static_cast<float>( 1.3 );
  1258.         else if (zR >= 0.4049 && zR < 0.4066 ) zS = static_cast<float>( 1.31 );
  1259.         else if (zR >= 0.4066 && zR < 0.4082 ) zS = static_cast<float>( 1.32 );
  1260.         else if (zR >= 0.4082 && zR < 0.4099 ) zS = static_cast<float>( 1.33 );
  1261.         else if (zR >= 0.4099 && zR < 0.4115 ) zS = static_cast<float>( 1.34 );
  1262.         else if (zR >= 0.4115 && zR < 0.4131 ) zS = static_cast<float>( 1.35 );
  1263.         else if (zR >= 0.4131 && zR < 0.4147 ) zS = static_cast<float>( 1.36 );
  1264.         else if (zR >= 0.4147 && zR < 0.4162 ) zS = static_cast<float>( 1.37 );
  1265.         else if (zR >= 0.4162 && zR < 0.4177 ) zS = static_cast<float>( 1.38 );
  1266.         else if (zR >= 0.4177 && zR < 0.4192 ) zS = static_cast<float>( 1.39 );
  1267.         else if (zR >= 0.4192 && zR < 0.4207 ) zS = static_cast<float>( 1.4 );
  1268.         else if (zR >= 0.4207 && zR < 0.4222 ) zS = static_cast<float>( 1.41 );
  1269.         else if (zR >= 0.4222 && zR < 0.4236 ) zS = static_cast<float>( 1.42 );
  1270.         else if (zR >= 0.4236 && zR < 0.4251 ) zS = static_cast<float>( 1.43 );
  1271.         else if (zR >= 0.4251 && zR < 0.4265 ) zS = static_cast<float>( 1.44 );
  1272.         else if (zR >= 0.4265 && zR < 0.4279 ) zS = static_cast<float>( 1.45 );
  1273.         else if (zR >= 0.4279 && zR < 0.4292 ) zS = static_cast<float>( 1.46 );
  1274.         else if (zR >= 0.4292 && zR < 0.4306 ) zS = static_cast<float>( 1.47 );
  1275.         else if (zR >= 0.4306 && zR < 0.4319 ) zS = static_cast<float>( 1.48 );
  1276.         else if (zR >= 0.4319 && zR < 0.4332 ) zS = static_cast<float>( 1.49 );
  1277.         else if (zR >= 0.4332 && zR < 0.4345 ) zS = static_cast<float>( 1.5 );
  1278.         else if (zR >= 0.4345 && zR < 0.4357 ) zS = static_cast<float>( 1.51 );
  1279.         else if (zR >= 0.4357 && zR < 0.437 ) zS = static_cast<float>( 1.52 );
  1280.         else if (zR >= 0.437 && zR < 0.4382 ) zS = static_cast<float>( 1.53 );
  1281.         else if (zR >= 0.4382 && zR < 0.4394 ) zS = static_cast<float>( 1.54 );
  1282.         else if (zR >= 0.4394 && zR < 0.4406 ) zS = static_cast<float>( 1.55 );
  1283.         else if (zR >= 0.4406 && zR < 0.4418 ) zS = static_cast<float>( 1.56 );
  1284.         else if (zR >= 0.4418 && zR < 0.4429 ) zS = static_cast<float>( 1.57 );
  1285.         else if (zR >= 0.4429 && zR < 0.4441 ) zS = static_cast<float>( 1.58 );
  1286.         else if (zR >= 0.4441 && zR < 0.4452 ) zS = static_cast<float>( 1.59 );
  1287.         else if (zR >= 0.4452 && zR < 0.4463 ) zS = static_cast<float>( 1.6 );
  1288.         else if (zR >= 0.4463 && zR < 0.4474 ) zS = static_cast<float>( 1.61 );
  1289.         else if (zR >= 0.4474 && zR < 0.4484 ) zS = static_cast<float>( 1.62 );
  1290.         else if (zR >= 0.4484 && zR < 0.4495 ) zS = static_cast<float>( 1.63 );
  1291.         else if (zR >= 0.4495 && zR < 0.4505 ) zS = static_cast<float>( 1.64 );
  1292.         else if (zR >= 0.4505 && zR < 0.4515 ) zS = static_cast<float>( 1.65 );
  1293.         else if (zR >= 0.4515 && zR < 0.4525 ) zS = static_cast<float>( 1.66 );
  1294.         else if (zR >= 0.4525 && zR < 0.4535 ) zS = static_cast<float>( 1.67 );
  1295.         else if (zR >= 0.4535 && zR < 0.4545 ) zS = static_cast<float>( 1.68 );
  1296.         else if (zR >= 0.4545 && zR < 0.4554 ) zS = static_cast<float>( 1.69 );
  1297.         else if (zR >= 0.4554 && zR < 0.4564 ) zS = static_cast<float>( 1.7 );
  1298.         else if (zR >= 0.4564 && zR < 0.4573 ) zS = static_cast<float>( 1.71 );
  1299.         else if (zR >= 0.4573 && zR < 0.4582 ) zS = static_cast<float>( 1.72 );
  1300.         else if (zR >= 0.4582 && zR < 0.4591 ) zS = static_cast<float>( 1.73 );
  1301.         else if (zR >= 0.4591 && zR < 0.4599 ) zS = static_cast<float>( 1.74 );
  1302.         else if (zR >= 0.4599 && zR < 0.4608 ) zS = static_cast<float>( 1.75 );
  1303.         else if (zR >= 0.4608 && zR < 0.4616 ) zS = static_cast<float>( 1.76 );
  1304.         else if (zR >= 0.4616 && zR < 0.4625 ) zS = static_cast<float>( 1.77 );
  1305.         else if (zR >= 0.4625 && zR < 0.4633 ) zS = static_cast<float>( 1.78 );
  1306.         else if (zR >= 0.4633 && zR < 0.4641 ) zS = static_cast<float>( 1.79 );
  1307.         else if (zR >= 0.4641 && zR < 0.4649 ) zS = static_cast<float>( 1.8 );
  1308.         else if (zR >= 0.4649 && zR < 0.4656 ) zS = static_cast<float>( 1.81 );
  1309.         else if (zR >= 0.4656 && zR < 0.4664 ) zS = static_cast<float>( 1.82 );
  1310.         else if (zR >= 0.4664 && zR < 0.4671 ) zS = static_cast<float>( 1.83 );
  1311.         else if (zR >= 0.4671 && zR < 0.4678 ) zS = static_cast<float>( 1.84 );
  1312.         else if (zR >= 0.4678 && zR < 0.4686 ) zS = static_cast<float>( 1.85 );
  1313.         else if (zR >= 0.4686 && zR < 0.4693 ) zS = static_cast<float>( 1.86 );
  1314.         else if (zR >= 0.4693 && zR < 0.4699 ) zS = static_cast<float>( 1.87 );
  1315.         else if (zR >= 0.4699 && zR < 0.4706 ) zS = static_cast<float>( 1.88 );
  1316.         else if (zR >= 0.4706 && zR < 0.4713 ) zS = static_cast<float>( 1.89 );
  1317.         else if (zR >= 0.4713 && zR < 0.4719 ) zS = static_cast<float>( 1.9 );
  1318.         else if (zR >= 0.4719 && zR < 0.4726 ) zS = static_cast<float>( 1.91 );
  1319.         else if (zR >= 0.4726 && zR < 0.4732 ) zS = static_cast<float>( 1.92 );
  1320.         else if (zR >= 0.4732 && zR < 0.4738 ) zS = static_cast<float>( 1.93 );
  1321.         else if (zR >= 0.4738 && zR < 0.4744 ) zS = static_cast<float>( 1.94 );
  1322.         else if (zR >= 0.4744 && zR < 0.475 ) zS = static_cast<float>( 1.95 );
  1323.         else if (zR >= 0.475 && zR < 0.4756 ) zS = static_cast<float>( 1.96 );
  1324.         else if (zR >= 0.4756 && zR < 0.4761 ) zS = static_cast<float>( 1.97 );
  1325.         else if (zR >= 0.4761 && zR < 0.4767 ) zS = static_cast<float>( 1.98 );
  1326.         else zS = static_cast<float>( 1.99 );
  1327.  break;  
  1328.  case 2:  
  1329.  if (zR >= 0.4772 && zR < 0.4778 ) zS = static_cast<float>( 2 );
  1330.         else if (zR >= 0.4778 && zR < 0.4783 ) zS = static_cast<float>( 2.01 );
  1331.         else if (zR >= 0.4783 && zR < 0.4788 ) zS = static_cast<float>( 2.02 );
  1332.         else if (zR >= 0.4788 && zR < 0.4793 ) zS = static_cast<float>( 2.03 );
  1333.         else if (zR >= 0.4793 && zR < 0.4798 ) zS = static_cast<float>( 2.04 );
  1334.         else if (zR >= 0.4798 && zR < 0.4803 ) zS = static_cast<float>( 2.05 );
  1335.         else if (zR >= 0.4803 && zR < 0.4808 ) zS = static_cast<float>( 2.06 );
  1336.         else if (zR >= 0.4808 && zR < 0.4812 ) zS = static_cast<float>( 2.07 );
  1337.         else if (zR >= 0.4812 && zR < 0.4817 ) zS = static_cast<float>( 2.08 );
  1338.         else if (zR >= 0.4817 && zR < 0.4821 ) zS = static_cast<float>( 2.09 );
  1339.         else if (zR >= 0.4821 && zR < 0.4826 ) zS = static_cast<float>( 2.1 );
  1340.         else if (zR >= 0.4826 && zR < 0.483 ) zS = static_cast<float>( 2.11 );
  1341.         else if (zR >= 0.483 && zR < 0.4834 ) zS = static_cast<float>( 2.12 );
  1342.         else if (zR >= 0.4834 && zR < 0.4838 ) zS = static_cast<float>( 2.13 );
  1343.         else if (zR >= 0.4838 && zR < 0.4842 ) zS = static_cast<float>( 2.14 );
  1344.         else if (zR >= 0.4842 && zR < 0.4846 ) zS = static_cast<float>( 2.15 );
  1345.         else if (zR >= 0.4846 && zR < 0.485 ) zS = static_cast<float>( 2.16 );
  1346.         else if (zR >= 0.485 && zR < 0.4854 ) zS = static_cast<float>( 2.17 );
  1347.         else if (zR >= 0.4854 && zR < 0.4857 ) zS = static_cast<float>( 2.18 );
  1348.         else if (zR >= 0.4857 && zR < 0.4861 ) zS = static_cast<float>( 2.19 );
  1349.         else if (zR >= 0.4861 && zR < 0.4864 ) zS = static_cast<float>( 2.2 );
  1350.         else if (zR >= 0.4864 && zR < 0.4868 ) zS = static_cast<float>( 2.21 );
  1351.         else if (zR >= 0.4868 && zR < 0.4871 ) zS = static_cast<float>( 2.22 );
  1352.         else if (zR >= 0.4871 && zR < 0.4875 ) zS = static_cast<float>( 2.23 );
  1353.         else if (zR >= 0.4875 && zR < 0.4878 ) zS = static_cast<float>( 2.24 );
  1354.         else if (zR >= 0.4878 && zR < 0.4881 ) zS = static_cast<float>( 2.25 );
  1355.         else if (zR >= 0.4881 && zR < 0.4884 ) zS = static_cast<float>( 2.26 );
  1356.         else if (zR >= 0.4884 && zR < 0.4887 ) zS = static_cast<float>( 2.27 );
  1357.         else if (zR >= 0.4887 && zR < 0.489 ) zS = static_cast<float>( 2.28 );
  1358.         else if (zR >= 0.489 && zR < 0.4893 ) zS = static_cast<float>( 2.29 );
  1359.         else if (zR >= 0.4893 && zR < 0.4896 ) zS = static_cast<float>( 2.3 );
  1360.         else if (zR >= 0.4896 && zR < 0.4898 ) zS = static_cast<float>( 2.31 );
  1361.         else if (zR >= 0.4898 && zR < 0.4901 ) zS = static_cast<float>( 2.32 );
  1362.         else if (zR >= 0.4901 && zR < 0.4904 ) zS = static_cast<float>( 2.33 );
  1363.         else if (zR >= 0.4904 && zR < 0.4906 ) zS = static_cast<float>( 2.34 );
  1364.         else if (zR >= 0.4906 && zR < 0.4909 ) zS = static_cast<float>( 2.35 );
  1365.         else if (zR >= 0.4909 && zR < 0.4911 ) zS = static_cast<float>( 2.36 );
  1366.         else if (zR >= 0.4911 && zR < 0.4913 ) zS = static_cast<float>( 2.37 );
  1367.         else if (zR >= 0.4913 && zR < 0.4916 ) zS = static_cast<float>( 2.38 );
  1368.         else if (zR >= 0.4916 && zR < 0.4918 ) zS = static_cast<float>( 2.39 );
  1369.         else if (zR >= 0.4918 && zR < 0.492 ) zS = static_cast<float>( 2.4 );
  1370.         else if (zR >= 0.492 && zR < 0.4922 ) zS = static_cast<float>( 2.41 );
  1371.         else if (zR >= 0.4922 && zR < 0.4925 ) zS = static_cast<float>( 2.42 );
  1372.         else if (zR >= 0.4925 && zR < 0.4927 ) zS = static_cast<float>( 2.43 );
  1373.         else if (zR >= 0.4927 && zR < 0.4929 ) zS = static_cast<float>( 2.44 );
  1374.         else if (zR >= 0.4929 && zR < 0.4931 ) zS = static_cast<float>( 2.45 );
  1375.         else if (zR >= 0.4931 && zR < 0.4932 ) zS = static_cast<float>( 2.46 );
  1376.         else if (zR >= 0.4932 && zR < 0.4934 ) zS = static_cast<float>( 2.47 );
  1377.         else if (zR >= 0.4934 && zR < 0.4936 ) zS = static_cast<float>( 2.48 );
  1378.         else if (zR >= 0.4936 && zR < 0.4938 ) zS = static_cast<float>( 2.49 );
  1379.         else if (zR >= 0.4938 && zR < 0.494 ) zS = static_cast<float>( 2.5 );
  1380.         else if (zR >= 0.494 && zR < 0.4941 ) zS = static_cast<float>( 2.51 );
  1381.         else if (zR >= 0.4941 && zR < 0.4943 ) zS = static_cast<float>( 2.52 );
  1382.         else if (zR >= 0.4943 && zR < 0.4945 ) zS = static_cast<float>( 2.53 );
  1383.         else if (zR >= 0.4945 && zR < 0.4946 ) zS = static_cast<float>( 2.54 );
  1384.         else if (zR >= 0.4946 && zR < 0.4948 ) zS = static_cast<float>( 2.55 );
  1385.         else if (zR >= 0.4948 && zR < 0.4949 ) zS = static_cast<float>( 2.56 );
  1386.         else if (zR >= 0.4949 && zR < 0.4951 ) zS = static_cast<float>( 2.57 );
  1387.         else if (zR >= 0.4951 && zR < 0.4952 ) zS = static_cast<float>( 2.58 );
  1388.         else if (zR >= 0.4952 && zR < 0.4953 ) zS = static_cast<float>( 2.59 );
  1389.         else if (zR >= 0.4953 && zR < 0.4955 ) zS = static_cast<float>( 2.6 );
  1390.         else if (zR >= 0.4955 && zR < 0.4956 ) zS = static_cast<float>( 2.61 );
  1391.         else if (zR >= 0.4956 && zR < 0.4957 ) zS = static_cast<float>( 2.62 );
  1392.         else if (zR >= 0.4957 && zR < 0.4959 ) zS = static_cast<float>( 2.63 );
  1393.         else if (zR >= 0.4959 && zR < 0.496 ) zS = static_cast<float>( 2.64 );
  1394.         else if (zR >= 0.496 && zR < 0.4961 ) zS = static_cast<float>( 2.65 );
  1395.         else if (zR >= 0.4961 && zR < 0.4962 ) zS = static_cast<float>( 2.66 );
  1396.         else if (zR >= 0.4962 && zR < 0.4963 ) zS = static_cast<float>( 2.67 );
  1397.         else if (zR >= 0.4963 && zR < 0.4964 ) zS = static_cast<float>( 2.68 );
  1398.         else if (zR >= 0.4964 && zR < 0.4965 ) zS = static_cast<float>( 2.69 );
  1399.         else if (zR >= 0.4965 && zR < 0.4966 ) zS = static_cast<float>( 2.7 );
  1400.         else if (zR >= 0.4966 && zR < 0.4967 ) zS = static_cast<float>( 2.71 );
  1401.         else if (zR >= 0.4967 && zR < 0.4968 ) zS = static_cast<float>( 2.72 );
  1402.         else if (zR >= 0.4968 && zR < 0.4969 ) zS = static_cast<float>( 2.73 );
  1403.         else if (zR >= 0.4969 && zR < 0.497 ) zS = static_cast<float>( 2.74 );
  1404.         else if (zR >= 0.497 && zR < 0.4971 ) zS = static_cast<float>( 2.75 );
  1405.         else if (zR >= 0.4971 && zR < 0.4972 ) zS = static_cast<float>( 2.76 );
  1406.         else if (zR >= 0.4972 && zR < 0.4973 ) zS = static_cast<float>( 2.77 );
  1407.         else if (zR >= 0.4973 && zR < 0.4974 ) zS = static_cast<float>( 2.78 );
  1408.         else if (zR >= 0.4974 && zR < 0.4975 ) zS = static_cast<float>( 2.79 );
  1409.         else if (zR >= 0.4975 && zR < 0.4976 ) zS = static_cast<float>( 2.81 );
  1410.         else if (zR >= 0.4976 && zR < 0.4977 ) zS = static_cast<float>( 2.82 );
  1411.         else if (zR >= 0.4977 && zR < 0.4978 ) zS = static_cast<float>( 2.83 );
  1412.         else if (zR >= 0.4978 && zR < 0.4979 ) zS = static_cast<float>( 2.85 );
  1413.         else if (zR >= 0.4979 && zR < 0.498 ) zS = static_cast<float>( 2.86 );
  1414.         else if (zR >= 0.498 && zR < 0.4981 ) zS = static_cast<float>( 2.88 );
  1415.         else if (zR >= 0.4981 && zR < 0.4982 ) zS = static_cast<float>( 2.89 );
  1416.         else if (zR >= 0.4982 && zR < 0.4983 ) zS = static_cast<float>( 2.91 );
  1417.         else if (zR >= 0.4983 && zR < 0.4984 ) zS = static_cast<float>( 2.93 );
  1418.         else if (zR >= 0.4984 && zR < 0.4985 ) zS = static_cast<float>( 2.94 );
  1419.         else if (zR >= 0.4985 && zR < 0.4986 ) zS = static_cast<float>( 2.96 );
  1420.         else if (zR >= 0.4986 && zR < 0.4987 ) zS = static_cast<float>( 2.98 );
  1421.         else if (zR >= 0.4987 && zR < 0.4988 ) zS = static_cast<float>( 3 );
  1422.         else if (zR >= 0.4988 && zR < 0.4989 ) zS = static_cast<float>( 3.03 );
  1423.         else if (zR >= 0.4989 && zR < 0.499 ) zS = static_cast<float>( 3.05 );
  1424.         else if (zR >= 0.499 && zR < 0.4991 ) zS = static_cast<float>( 3.08 );
  1425.         else if (zR >= 0.4991 && zR < 0.4992 ) zS = static_cast<float>( 3.11 );
  1426.         else if (zR >= 0.4992 && zR < 0.4993 ) zS = static_cast<float>( 3.15 );
  1427.         else if (zR >= 0.4993 && zR < 0.4994 ) zS = static_cast<float>( 3.18 );
  1428.         else if (zR >= 0.4994 && zR < 0.4995 ) zS = static_cast<float>( 3.22 );
  1429.         else if (zR >= 0.4995 && zR < 0.4996 ) zS = static_cast<float>( 3.27 );
  1430.         else if (zR >= 0.4996 && zR < 0.4997 ) zS = static_cast<float>( 3.33 );
  1431.         else if (zR >= 0.4997 && zR < 0.4998 ) zS = static_cast<float>( 3.39 );
  1432.         else if (zR >= 0.4998 && zR < 0.4999 ) zS = static_cast<float>( 3.49 );
  1433.         else zS = static_cast<float>( 3.7 );
  1434.     }
  1435.     zS *= signFlip;
  1436.     return (zS);
  1437. }
  1438.  
  1439. float corrAnalysis(long double arr0[], long double arr1[], int& n)
  1440. {
  1441.     long double mean1, mean0, sum = 0, avgSum;
  1442.     float r, sD1, sD0, sdProd, meanProd;
  1443.     mean0 = findMean(arr0, n);
  1444.     sD0 = findStdDev(arr0, n);
  1445.     mean1 = findMean(arr1, n);
  1446.     sD1 = findStdDev(arr1, n);
  1447.     sdProd = sD1 * sD0;
  1448.     meanProd = mean1 * mean0;
  1449.  
  1450.     for (int i = 0; i < n; i++) sum += (arr0[i] * arr1[i]);
  1451.     avgSum = sum/n;
  1452.     r = static_cast<float>((avgSum - meanProd)/sdProd);
  1453.     return r;
  1454.  
  1455. }
  1456.  
  1457. void corrSignificance(float pR, int& n)
  1458. {
  1459.     float aPr = abs(pR);
  1460.     int df;
  1461.     if (n > 102) df = 100; else df = n-2;
  1462.     bool p50 = false, p20 = false, p10 = false, p05 = false, p02 = false, p01 = false;
  1463.  
  1464.     switch(df)
  1465.     {
  1466.         case 1:
  1467.             if (aPr >= 0.7071) p50 = true;
  1468.             if (aPr >= 0.9511) p20 = true;
  1469.             if (aPr >= 0.9877) p10 = true;
  1470.             if (aPr >= 0.9969) p05 = true;
  1471.             if (aPr >= 0.9995) p02 = true;
  1472.             if (aPr >= 0.9999) p01 = true;
  1473.         break;
  1474.        
  1475.         case 2:
  1476.             if (aPr >= 0.5000) p50 = true;
  1477.             if (aPr >= 0.8000) p20 = true;
  1478.             if (aPr >= 0.9000) p10 = true;
  1479.             if (aPr >= 0.9500) p05 = true;
  1480.             if (aPr >= 0.9800) p02 = true;
  1481.             if (aPr >= 0.9900) p01 = true;
  1482.         break;
  1483.        
  1484.         case 3:
  1485.             if (aPr >= 0.4040) p50 = true;
  1486.             if (aPr >= 0.6870) p20 = true;
  1487.             if (aPr >= 0.8054) p10 = true;
  1488.             if (aPr >= 0.8783) p05 = true;
  1489.             if (aPr >= 0.9343) p02 = true;
  1490.             if (aPr >= 0.9587) p01 = true;
  1491.         break;
  1492.        
  1493.         case 4:
  1494.             if (aPr >= 0.3473) p50 = true;
  1495.             if (aPr >= 0.6084) p20 = true;
  1496.             if (aPr >= 0.7293) p10 = true;
  1497.             if (aPr >= 0.8114) p05 = true;
  1498.             if (aPr >= 0.8822) p02 = true;
  1499.             if (aPr >= 0.9172) p01 = true;
  1500.         break;
  1501.        
  1502.         case 5:
  1503.             if (aPr >= 0.3091) p50 = true;
  1504.             if (aPr >= 0.5509) p20 = true;
  1505.             if (aPr >= 0.6694) p10 = true;
  1506.             if (aPr >= 0.7545) p05 = true;
  1507.             if (aPr >= 0.8329) p02 = true;
  1508.             if (aPr >= 0.8745) p01 = true;
  1509.         break;
  1510.        
  1511.         case 6:
  1512.             if (aPr >= 0.2811) p50 = true;
  1513.             if (aPr >= 0.5067) p20 = true;
  1514.             if (aPr >= 0.6215) p10 = true;
  1515.             if (aPr >= 0.7067) p05 = true;
  1516.             if (aPr >= 0.7887) p02 = true;
  1517.             if (aPr >= 0.8343) p01 = true;
  1518.         break;
  1519.        
  1520.         case 7:
  1521.             if (aPr >= 0.2596) p50 = true;
  1522.             if (aPr >= 0.4716) p20 = true;
  1523.             if (aPr >= 0.5822) p10 = true;
  1524.             if (aPr >= 0.6664) p05 = true;
  1525.             if (aPr >= 0.7498) p02 = true;
  1526.             if (aPr >= 0.7977) p01 = true;
  1527.         break;
  1528.        
  1529.         case 8:
  1530.             if (aPr >= 0.2423) p50 = true;
  1531.             if (aPr >= 0.4428) p20 = true;
  1532.             if (aPr >= 0.5494) p10 = true;
  1533.             if (aPr >= 0.6319) p05 = true;
  1534.             if (aPr >= 0.7155) p02 = true;
  1535.             if (aPr >= 0.7646) p01 = true;
  1536.         break;
  1537.        
  1538.         case 9:
  1539.             if (aPr >= 0.2281) p50 = true;
  1540.             if (aPr >= 0.4187) p20 = true;
  1541.             if (aPr >= 0.5214) p10 = true;
  1542.             if (aPr >= 0.6021) p05 = true;
  1543.             if (aPr >= 0.6851) p02 = true;
  1544.             if (aPr >= 0.7348) p01 = true;
  1545.         break;
  1546.        
  1547.         case 10:
  1548.             if (aPr >= 0.2161) p50 = true;
  1549.             if (aPr >= 0.3981) p20 = true;
  1550.             if (aPr >= 0.4973) p10 = true;
  1551.             if (aPr >= 0.5760) p05 = true;
  1552.             if (aPr >= 0.6581) p02 = true;
  1553.             if (aPr >= 0.7079) p01 = true;
  1554.         break;
  1555.        
  1556.         case 11:
  1557.             if (aPr >= 0.2058) p50 = true;
  1558.             if (aPr >= 0.3802) p20 = true;
  1559.             if (aPr >= 0.4762) p10 = true;
  1560.             if (aPr >= 0.5529) p05 = true;
  1561.             if (aPr >= 0.6339) p02 = true;
  1562.             if (aPr >= 0.6835) p01 = true;
  1563.         break;
  1564.        
  1565.         case 12:
  1566.             if (aPr >= 0.1968) p50 = true;
  1567.             if (aPr >= 0.3646) p20 = true;
  1568.             if (aPr >= 0.4575) p10 = true;
  1569.             if (aPr >= 0.5324) p05 = true;
  1570.             if (aPr >= 0.6120) p02 = true;
  1571.             if (aPr >= 0.6614) p01 = true;
  1572.         break;
  1573.        
  1574.         case 13:
  1575.             if (aPr >= 0.1890) p50 = true;
  1576.             if (aPr >= 0.3507) p20 = true;
  1577.             if (aPr >= 0.4409) p10 = true;
  1578.             if (aPr >= 0.5140) p05 = true;
  1579.             if (aPr >= 0.5923) p02 = true;
  1580.             if (aPr >= 0.6411) p01 = true;
  1581.         break;
  1582.        
  1583.         case 14:
  1584.             if (aPr >= 0.1820) p50 = true;
  1585.             if (aPr >= 0.3383) p20 = true;
  1586.             if (aPr >= 0.4259) p10 = true;
  1587.             if (aPr >= 0.4973) p05 = true;
  1588.             if (aPr >= 0.5742) p02 = true;
  1589.             if (aPr >= 0.6226) p01 = true;
  1590.         break;
  1591.        
  1592.         case 15:
  1593.             if (aPr >= 0.1757) p50 = true;
  1594.             if (aPr >= 0.3271) p20 = true;
  1595.             if (aPr >= 0.4124) p10 = true;
  1596.             if (aPr >= 0.4821) p05 = true;
  1597.             if (aPr >= 0.5577) p02 = true;
  1598.             if (aPr >= 0.6055) p01 = true;
  1599.         break;
  1600.        
  1601.         case 16:
  1602.             if (aPr >= 0.1700) p50 = true;
  1603.             if (aPr >= 0.3170) p20 = true;
  1604.             if (aPr >= 0.4000) p10 = true;
  1605.             if (aPr >= 0.4683) p05 = true;
  1606.             if (aPr >= 0.5425) p02 = true;
  1607.             if (aPr >= 0.5897) p01 = true;
  1608.         break;
  1609.        
  1610.         case 17:
  1611.             if (aPr >= 0.1649) p50 = true;
  1612.             if (aPr >= 0.3077) p20 = true;
  1613.             if (aPr >= 0.3887) p10 = true;
  1614.             if (aPr >= 0.4555) p05 = true;
  1615.             if (aPr >= 0.5285) p02 = true;
  1616.             if (aPr >= 0.5751) p01 = true;
  1617.         break;
  1618.        
  1619.         case 18:
  1620.             if (aPr >= 0.1602) p50 = true;
  1621.             if (aPr >= 0.2992) p20 = true;
  1622.             if (aPr >= 0.3783) p10 = true;
  1623.             if (aPr >= 0.4438) p05 = true;
  1624.             if (aPr >= 0.5155) p02 = true;
  1625.             if (aPr >= 0.5614) p01 = true;
  1626.         break;
  1627.        
  1628.         case 19:
  1629.             if (aPr >= 0.1558) p50 = true;
  1630.             if (aPr >= 0.2914) p20 = true;
  1631.             if (aPr >= 0.3687) p10 = true;
  1632.             if (aPr >= 0.4329) p05 = true;
  1633.             if (aPr >= 0.5034) p02 = true;
  1634.             if (aPr >= 0.5487) p01 = true;
  1635.         break;
  1636.        
  1637.         case 20:
  1638.             if (aPr >= 0.1518) p50 = true;
  1639.             if (aPr >= 0.2841) p20 = true;
  1640.             if (aPr >= 0.3598) p10 = true;
  1641.             if (aPr >= 0.4227) p05 = true;
  1642.             if (aPr >= 0.4921) p02 = true;
  1643.             if (aPr >= 0.5368) p01 = true;
  1644.         break;
  1645.        
  1646.         case 21:
  1647.             if (aPr >= 0.1481) p50 = true;
  1648.             if (aPr >= 0.2774) p20 = true;
  1649.             if (aPr >= 0.3515) p10 = true;
  1650.             if (aPr >= 0.4132) p05 = true;
  1651.             if (aPr >= 0.4815) p02 = true;
  1652.             if (aPr >= 0.5256) p01 = true;
  1653.         break;
  1654.        
  1655.         case 22:
  1656.             if (aPr >= 0.1447) p50 = true;
  1657.             if (aPr >= 0.2711) p20 = true;
  1658.             if (aPr >= 0.3438) p10 = true;
  1659.             if (aPr >= 0.4044) p05 = true;
  1660.             if (aPr >= 0.4716) p02 = true;
  1661.             if (aPr >= 0.5151) p01 = true;
  1662.         break;
  1663.        
  1664.         case 23:
  1665.             if (aPr >= 0.1415) p50 = true;
  1666.             if (aPr >= 0.2653) p20 = true;
  1667.             if (aPr >= 0.3365) p10 = true;
  1668.             if (aPr >= 0.3961) p05 = true;
  1669.             if (aPr >= 0.4622) p02 = true;
  1670.             if (aPr >= 0.5052) p01 = true;
  1671.         break;
  1672.        
  1673.         case 24:
  1674.             if (aPr >= 0.1384) p50 = true;
  1675.             if (aPr >= 0.2598) p20 = true;
  1676.             if (aPr >= 0.3297) p10 = true;
  1677.             if (aPr >= 0.3882) p05 = true;
  1678.             if (aPr >= 0.4534) p02 = true;
  1679.             if (aPr >= 0.4958) p01 = true;
  1680.         break;
  1681.        
  1682.         case 25:
  1683.             if (aPr >= 0.1356) p50 = true;
  1684.             if (aPr >= 0.2546) p20 = true;
  1685.             if (aPr >= 0.3233) p10 = true;
  1686.             if (aPr >= 0.3809) p05 = true;
  1687.             if (aPr >= 0.4451) p02 = true;
  1688.             if (aPr >= 0.4869) p01 = true;
  1689.         break;
  1690.        
  1691.         case 26:
  1692.             if (aPr >= 0.1330) p50 = true;
  1693.             if (aPr >= 0.2497) p20 = true;
  1694.             if (aPr >= 0.3172) p10 = true;
  1695.             if (aPr >= 0.3739) p05 = true;
  1696.             if (aPr >= 0.4372) p02 = true;
  1697.             if (aPr >= 0.4785) p01 = true;
  1698.         break;
  1699.        
  1700.         case 27:
  1701.             if (aPr >= 0.1305) p50 = true;
  1702.             if (aPr >= 0.2451) p20 = true;
  1703.             if (aPr >= 0.3115) p10 = true;
  1704.             if (aPr >= 0.3673) p05 = true;
  1705.             if (aPr >= 0.4297) p02 = true;
  1706.             if (aPr >= 0.4705) p01 = true;
  1707.         break;
  1708.        
  1709.         case 28:
  1710.             if (aPr >= 0.1281) p50 = true;
  1711.             if (aPr >= 0.2407) p20 = true;
  1712.             if (aPr >= 0.3061) p10 = true;
  1713.             if (aPr >= 0.3610) p05 = true;
  1714.             if (aPr >= 0.4226) p02 = true;
  1715.             if (aPr >= 0.4629) p01 = true;
  1716.         break;
  1717.        
  1718.         case 29:
  1719.             if (aPr >= 0.1258) p50 = true;
  1720.             if (aPr >= 0.2366) p20 = true;
  1721.             if (aPr >= 0.3009) p10 = true;
  1722.             if (aPr >= 0.3550) p05 = true;
  1723.             if (aPr >= 0.4158) p02 = true;
  1724.             if (aPr >= 0.4556) p01 = true;
  1725.         break;
  1726.        
  1727.         case 30:
  1728.             if (aPr >= 0.1237) p50 = true;
  1729.             if (aPr >= 0.2327) p20 = true;
  1730.             if (aPr >= 0.2960) p10 = true;
  1731.             if (aPr >= 0.3494) p05 = true;
  1732.             if (aPr >= 0.4093) p02 = true;
  1733.             if (aPr >= 0.4487) p01 = true;
  1734.         break;
  1735.        
  1736.         case 31:
  1737.             if (aPr >= 0.1217) p50 = true;
  1738.             if (aPr >= 0.2289) p20 = true;
  1739.             if (aPr >= 0.2913) p10 = true;
  1740.             if (aPr >= 0.3440) p05 = true;
  1741.             if (aPr >= 0.4032) p02 = true;
  1742.             if (aPr >= 0.4421) p01 = true;
  1743.         break;
  1744.        
  1745.         case 32:
  1746.             if (aPr >= 0.1197) p50 = true;
  1747.             if (aPr >= 0.2254) p20 = true;
  1748.             if (aPr >= 0.2869) p10 = true;
  1749.             if (aPr >= 0.3388) p05 = true;
  1750.             if (aPr >= 0.3972) p02 = true;
  1751.             if (aPr >= 0.4357) p01 = true;
  1752.         break;
  1753.        
  1754.         case 33:
  1755.             if (aPr >= 0.1179) p50 = true;
  1756.             if (aPr >= 0.2220) p20 = true;
  1757.             if (aPr >= 0.2826) p10 = true;
  1758.             if (aPr >= 0.3338) p05 = true;
  1759.             if (aPr >= 0.3916) p02 = true;
  1760.             if (aPr >= 0.4296) p01 = true;
  1761.         break;
  1762.        
  1763.         case 34:
  1764.             if (aPr >= 0.1161) p50 = true;
  1765.             if (aPr >= 0.2187) p20 = true;
  1766.             if (aPr >= 0.2785) p10 = true;
  1767.             if (aPr >= 0.3291) p05 = true;
  1768.             if (aPr >= 0.3862) p02 = true;
  1769.             if (aPr >= 0.4238) p01 = true;
  1770.         break;
  1771.        
  1772.         case 35:
  1773.             if (aPr >= 0.1144) p50 = true;
  1774.             if (aPr >= 0.2156) p20 = true;
  1775.             if (aPr >= 0.2746) p10 = true;
  1776.             if (aPr >= 0.3246) p05 = true;
  1777.             if (aPr >= 0.3810) p02 = true;
  1778.             if (aPr >= 0.4182) p01 = true;
  1779.         break;
  1780.        
  1781.         case 36:
  1782.             if (aPr >= 0.1128) p50 = true;
  1783.             if (aPr >= 0.2126) p20 = true;
  1784.             if (aPr >= 0.2709) p10 = true;
  1785.             if (aPr >= 0.3202) p05 = true;
  1786.             if (aPr >= 0.3760) p02 = true;
  1787.             if (aPr >= 0.4128) p01 = true;
  1788.         break;
  1789.        
  1790.         case 37:
  1791.             if (aPr >= 0.1113) p50 = true;
  1792.             if (aPr >= 0.2097) p20 = true;
  1793.             if (aPr >= 0.2673) p10 = true;
  1794.             if (aPr >= 0.3160) p05 = true;
  1795.             if (aPr >= 0.3712) p02 = true;
  1796.             if (aPr >= 0.4076) p01 = true;
  1797.         break;
  1798.        
  1799.         case 38:
  1800.             if (aPr >= 0.1098) p50 = true;
  1801.             if (aPr >= 0.2070) p20 = true;
  1802.             if (aPr >= 0.2638) p10 = true;
  1803.             if (aPr >= 0.3120) p05 = true;
  1804.             if (aPr >= 0.3665) p02 = true;
  1805.             if (aPr >= 0.4026) p01 = true;
  1806.         break;
  1807.        
  1808.         case 39:
  1809.             if (aPr >= 0.1084) p50 = true;
  1810.             if (aPr >= 0.2043) p20 = true;
  1811.             if (aPr >= 0.2605) p10 = true;
  1812.             if (aPr >= 0.3081) p05 = true;
  1813.             if (aPr >= 0.3621) p02 = true;
  1814.             if (aPr >= 0.3978) p01 = true;
  1815.         break;
  1816.        
  1817.         case 40:
  1818.             if (aPr >= 0.1070) p50 = true;
  1819.             if (aPr >= 0.2018) p20 = true;
  1820.             if (aPr >= 0.2573) p10 = true;
  1821.             if (aPr >= 0.3044) p05 = true;
  1822.             if (aPr >= 0.3578) p02 = true;
  1823.             if (aPr >= 0.3932) p01 = true;
  1824.         break;
  1825.        
  1826.         case 41:
  1827.             if (aPr >= 0.1057) p50 = true;
  1828.             if (aPr >= 0.1993) p20 = true;
  1829.             if (aPr >= 0.2542) p10 = true;
  1830.             if (aPr >= 0.3008) p05 = true;
  1831.             if (aPr >= 0.3536) p02 = true;
  1832.             if (aPr >= 0.3887) p01 = true;
  1833.         break;
  1834.        
  1835.         case 42:
  1836.             if (aPr >= 0.1044) p50 = true;
  1837.             if (aPr >= 0.1970) p20 = true;
  1838.             if (aPr >= 0.2512) p10 = true;
  1839.             if (aPr >= 0.2973) p05 = true;
  1840.             if (aPr >= 0.3496) p02 = true;
  1841.             if (aPr >= 0.3843) p01 = true;
  1842.         break;
  1843.        
  1844.         case 43:
  1845.             if (aPr >= 0.1032) p50 = true;
  1846.             if (aPr >= 0.1947) p20 = true;
  1847.             if (aPr >= 0.2483) p10 = true;
  1848.             if (aPr >= 0.2940) p05 = true;
  1849.             if (aPr >= 0.3457) p02 = true;
  1850.             if (aPr >= 0.3801) p01 = true;
  1851.         break;
  1852.        
  1853.         case 44:
  1854.             if (aPr >= 0.1020) p50 = true;
  1855.             if (aPr >= 0.1925) p20 = true;
  1856.             if (aPr >= 0.2455) p10 = true;
  1857.             if (aPr >= 0.2907) p05 = true;
  1858.             if (aPr >= 0.3420) p02 = true;
  1859.             if (aPr >= 0.3761) p01 = true;
  1860.         break;
  1861.        
  1862.         case 45:
  1863.             if (aPr >= 0.1008) p50 = true;
  1864.             if (aPr >= 0.1903) p20 = true;
  1865.             if (aPr >= 0.2429) p10 = true;
  1866.             if (aPr >= 0.2876) p05 = true;
  1867.             if (aPr >= 0.3384) p02 = true;
  1868.             if (aPr >= 0.3721) p01 = true;
  1869.         break;
  1870.        
  1871.         case 46:
  1872.             if (aPr >= 0.0997) p50 = true;
  1873.             if (aPr >= 0.1883) p20 = true;
  1874.             if (aPr >= 0.2403) p10 = true;
  1875.             if (aPr >= 0.2845) p05 = true;
  1876.             if (aPr >= 0.3348) p02 = true;
  1877.             if (aPr >= 0.3683) p01 = true;
  1878.         break;
  1879.        
  1880.         case 47:
  1881.             if (aPr >= 0.0987) p50 = true;
  1882.             if (aPr >= 0.1863) p20 = true;
  1883.             if (aPr >= 0.2377) p10 = true;
  1884.             if (aPr >= 0.2816) p05 = true;
  1885.             if (aPr >= 0.3314) p02 = true;
  1886.             if (aPr >= 0.3646) p01 = true;
  1887.         break;
  1888.        
  1889.         case 48:
  1890.             if (aPr >= 0.0976) p50 = true;
  1891.             if (aPr >= 0.1843) p20 = true;
  1892.             if (aPr >= 0.2353) p10 = true;
  1893.             if (aPr >= 0.2787) p05 = true;
  1894.             if (aPr >= 0.3281) p02 = true;
  1895.             if (aPr >= 0.3610) p01 = true;
  1896.         break;
  1897.        
  1898.         case 49:
  1899.             if (aPr >= 0.0966) p50 = true;
  1900.             if (aPr >= 0.1825) p20 = true;
  1901.             if (aPr >= 0.2329) p10 = true;
  1902.             if (aPr >= 0.2759) p05 = true;
  1903.             if (aPr >= 0.3249) p02 = true;
  1904.             if (aPr >= 0.3575) p01 = true;
  1905.         break;
  1906.        
  1907.         case 50:
  1908.             if (aPr >= 0.0956) p50 = true;
  1909.             if (aPr >= 0.1806) p20 = true;
  1910.             if (aPr >= 0.2306) p10 = true;
  1911.             if (aPr >= 0.2732) p05 = true;
  1912.             if (aPr >= 0.3218) p02 = true;
  1913.             if (aPr >= 0.3542) p01 = true;
  1914.         break;
  1915.        
  1916.         case 51:
  1917.             if (aPr >= 0.0947) p50 = true;
  1918.             if (aPr >= 0.1789) p20 = true;
  1919.             if (aPr >= 0.2284) p10 = true;
  1920.             if (aPr >= 0.2706) p05 = true;
  1921.             if (aPr >= 0.3188) p02 = true;
  1922.             if (aPr >= 0.3509) p01 = true;
  1923.         break;
  1924.        
  1925.         case 52:
  1926.             if (aPr >= 0.0938) p50 = true;
  1927.             if (aPr >= 0.1772) p20 = true;
  1928.             if (aPr >= 0.2262) p10 = true;
  1929.             if (aPr >= 0.2681) p05 = true;
  1930.             if (aPr >= 0.3158) p02 = true;
  1931.             if (aPr >= 0.3477) p01 = true;
  1932.         break;
  1933.        
  1934.         case 53:
  1935.             if (aPr >= 0.0929) p50 = true;
  1936.             if (aPr >= 0.1755) p20 = true;
  1937.             if (aPr >= 0.2241) p10 = true;
  1938.             if (aPr >= 0.2656) p05 = true;
  1939.             if (aPr >= 0.3129) p02 = true;
  1940.             if (aPr >= 0.3445) p01 = true;
  1941.         break;
  1942.        
  1943.         case 54:
  1944.             if (aPr >= 0.0920) p50 = true;
  1945.             if (aPr >= 0.1739) p20 = true;
  1946.             if (aPr >= 0.2221) p10 = true;
  1947.             if (aPr >= 0.2632) p05 = true;
  1948.             if (aPr >= 0.3102) p02 = true;
  1949.             if (aPr >= 0.3415) p01 = true;
  1950.         break;
  1951.        
  1952.         case 55:
  1953.             if (aPr >= 0.0912) p50 = true;
  1954.             if (aPr >= 0.1723) p20 = true;
  1955.             if (aPr >= 0.2201) p10 = true;
  1956.             if (aPr >= 0.2609) p05 = true;
  1957.             if (aPr >= 0.3074) p02 = true;
  1958.             if (aPr >= 0.3385) p01 = true;
  1959.         break;
  1960.        
  1961.         case 56:
  1962.             if (aPr >= 0.0904) p50 = true;
  1963.             if (aPr >= 0.1708) p20 = true;
  1964.             if (aPr >= 0.2181) p10 = true;
  1965.             if (aPr >= 0.2586) p05 = true;
  1966.             if (aPr >= 0.3048) p02 = true;
  1967.             if (aPr >= 0.3357) p01 = true;
  1968.         break;
  1969.        
  1970.         case 57:
  1971.             if (aPr >= 0.0896) p50 = true;
  1972.             if (aPr >= 0.1693) p20 = true;
  1973.             if (aPr >= 0.2162) p10 = true;
  1974.             if (aPr >= 0.2564) p05 = true;
  1975.             if (aPr >= 0.3022) p02 = true;
  1976.             if (aPr >= 0.3328) p01 = true;
  1977.         break;
  1978.        
  1979.         case 58:
  1980.             if (aPr >= 0.0888) p50 = true;
  1981.             if (aPr >= 0.1678) p20 = true;
  1982.             if (aPr >= 0.2144) p10 = true;
  1983.             if (aPr >= 0.2542) p05 = true;
  1984.             if (aPr >= 0.2997) p02 = true;
  1985.             if (aPr >= 0.3301) p01 = true;
  1986.         break;
  1987.        
  1988.         case 59:
  1989.             if (aPr >= 0.0880) p50 = true;
  1990.             if (aPr >= 0.1664) p20 = true;
  1991.             if (aPr >= 0.2126) p10 = true;
  1992.             if (aPr >= 0.2521) p05 = true;
  1993.             if (aPr >= 0.2972) p02 = true;
  1994.             if (aPr >= 0.3274) p01 = true;
  1995.         break;
  1996.        
  1997.         case 60:
  1998.             if (aPr >= 0.0873) p50 = true;
  1999.             if (aPr >= 0.1650) p20 = true;
  2000.             if (aPr >= 0.2108) p10 = true;
  2001.             if (aPr >= 0.2500) p05 = true;
  2002.             if (aPr >= 0.2948) p02 = true;
  2003.             if (aPr >= 0.3248) p01 = true;
  2004.         break;
  2005.        
  2006.         case 61:
  2007.             if (aPr >= 0.0866) p50 = true;
  2008.             if (aPr >= 0.1636) p20 = true;
  2009.             if (aPr >= 0.2091) p10 = true;
  2010.             if (aPr >= 0.2480) p05 = true;
  2011.             if (aPr >= 0.2925) p02 = true;
  2012.             if (aPr >= 0.3223) p01 = true;
  2013.         break;
  2014.        
  2015.         case 62:
  2016.             if (aPr >= 0.0858) p50 = true;
  2017.             if (aPr >= 0.1623) p20 = true;
  2018.             if (aPr >= 0.2075) p10 = true;
  2019.             if (aPr >= 0.2461) p05 = true;
  2020.             if (aPr >= 0.2902) p02 = true;
  2021.             if (aPr >= 0.3198) p01 = true;
  2022.         break;
  2023.        
  2024.         case 63:
  2025.             if (aPr >= 0.0852) p50 = true;
  2026.             if (aPr >= 0.1610) p20 = true;
  2027.             if (aPr >= 0.2058) p10 = true;
  2028.             if (aPr >= 0.2441) p05 = true;
  2029.             if (aPr >= 0.2880) p02 = true;
  2030.             if (aPr >= 0.3173) p01 = true;
  2031.         break;
  2032.        
  2033.         case 64:
  2034.             if (aPr >= 0.0845) p50 = true;
  2035.             if (aPr >= 0.1598) p20 = true;
  2036.             if (aPr >= 0.2042) p10 = true;
  2037.             if (aPr >= 0.2423) p05 = true;
  2038.             if (aPr >= 0.2858) p02 = true;
  2039.             if (aPr >= 0.3150) p01 = true;
  2040.         break;
  2041.        
  2042.         case 65:
  2043.             if (aPr >= 0.0838) p50 = true;
  2044.             if (aPr >= 0.1586) p20 = true;
  2045.             if (aPr >= 0.2027) p10 = true;
  2046.             if (aPr >= 0.2404) p05 = true;
  2047.             if (aPr >= 0.2837) p02 = true;
  2048.             if (aPr >= 0.3126) p01 = true;
  2049.         break;
  2050.        
  2051.         case 66:
  2052.             if (aPr >= 0.0832) p50 = true;
  2053.             if (aPr >= 0.1574) p20 = true;
  2054.             if (aPr >= 0.2012) p10 = true;
  2055.             if (aPr >= 0.2387) p05 = true;
  2056.             if (aPr >= 0.2816) p02 = true;
  2057.             if (aPr >= 0.3104) p01 = true;
  2058.         break;
  2059.        
  2060.         case 67:
  2061.             if (aPr >= 0.0826) p50 = true;
  2062.             if (aPr >= 0.1562) p20 = true;
  2063.             if (aPr >= 0.1997) p10 = true;
  2064.             if (aPr >= 0.2369) p05 = true;
  2065.             if (aPr >= 0.2796) p02 = true;
  2066.             if (aPr >= 0.3081) p01 = true;
  2067.         break;
  2068.        
  2069.         case 68:
  2070.             if (aPr >= 0.0820) p50 = true;
  2071.             if (aPr >= 0.1550) p20 = true;
  2072.             if (aPr >= 0.1982) p10 = true;
  2073.             if (aPr >= 0.2352) p05 = true;
  2074.             if (aPr >= 0.2776) p02 = true;
  2075.             if (aPr >= 0.3060) p01 = true;
  2076.         break;
  2077.        
  2078.         case 69:
  2079.             if (aPr >= 0.0814) p50 = true;
  2080.             if (aPr >= 0.1539) p20 = true;
  2081.             if (aPr >= 0.1968) p10 = true;
  2082.             if (aPr >= 0.2335) p05 = true;
  2083.             if (aPr >= 0.2756) p02 = true;
  2084.             if (aPr >= 0.3038) p01 = true;
  2085.         break;
  2086.        
  2087.         case 70:
  2088.             if (aPr >= 0.0808) p50 = true;
  2089.             if (aPr >= 0.1528) p20 = true;
  2090.             if (aPr >= 0.1954) p10 = true;
  2091.             if (aPr >= 0.2319) p05 = true;
  2092.             if (aPr >= 0.2737) p02 = true;
  2093.             if (aPr >= 0.3017) p01 = true;
  2094.         break;
  2095.        
  2096.         case 71:
  2097.             if (aPr >= 0.0802) p50 = true;
  2098.             if (aPr >= 0.1517) p20 = true;
  2099.             if (aPr >= 0.1940) p10 = true;
  2100.             if (aPr >= 0.2303) p05 = true;
  2101.             if (aPr >= 0.2718) p02 = true;
  2102.             if (aPr >= 0.2997) p01 = true;
  2103.         break;
  2104.        
  2105.         case 72:
  2106.             if (aPr >= 0.0796) p50 = true;
  2107.             if (aPr >= 0.1507) p20 = true;
  2108.             if (aPr >= 0.1927) p10 = true;
  2109.             if (aPr >= 0.2287) p05 = true;
  2110.             if (aPr >= 0.2700) p02 = true;
  2111.             if (aPr >= 0.2977) p01 = true;
  2112.         break;
  2113.        
  2114.         case 73:
  2115.             if (aPr >= 0.0791) p50 = true;
  2116.             if (aPr >= 0.1497) p20 = true;
  2117.             if (aPr >= 0.1914) p10 = true;
  2118.             if (aPr >= 0.2272) p05 = true;
  2119.             if (aPr >= 0.2682) p02 = true;
  2120.             if (aPr >= 0.2957) p01 = true;
  2121.         break;
  2122.        
  2123.         case 74:
  2124.             if (aPr >= 0.0786) p50 = true;
  2125.             if (aPr >= 0.1486) p20 = true;
  2126.             if (aPr >= 0.1901) p10 = true;
  2127.             if (aPr >= 0.2257) p05 = true;
  2128.             if (aPr >= 0.2664) p02 = true;
  2129.             if (aPr >= 0.2938) p01 = true;
  2130.         break;
  2131.        
  2132.         case 75:
  2133.             if (aPr >= 0.0780) p50 = true;
  2134.             if (aPr >= 0.1477) p20 = true;
  2135.             if (aPr >= 0.1888) p10 = true;
  2136.             if (aPr >= 0.2242) p05 = true;
  2137.             if (aPr >= 0.2647) p02 = true;
  2138.             if (aPr >= 0.2919) p01 = true;
  2139.         break;
  2140.        
  2141.         case 76:
  2142.             if (aPr >= 0.0775) p50 = true;
  2143.             if (aPr >= 0.1467) p20 = true;
  2144.             if (aPr >= 0.1876) p10 = true;
  2145.             if (aPr >= 0.2227) p05 = true;
  2146.             if (aPr >= 0.2630) p02 = true;
  2147.             if (aPr >= 0.2900) p01 = true;
  2148.         break;
  2149.        
  2150.         case 77:
  2151.             if (aPr >= 0.0770) p50 = true;
  2152.             if (aPr >= 0.1457) p20 = true;
  2153.             if (aPr >= 0.1864) p10 = true;
  2154.             if (aPr >= 0.2213) p05 = true;
  2155.             if (aPr >= 0.2613) p02 = true;
  2156.             if (aPr >= 0.2882) p01 = true;
  2157.         break;
  2158.        
  2159.         case 78:
  2160.             if (aPr >= 0.0765) p50 = true;
  2161.             if (aPr >= 0.1448) p20 = true;
  2162.             if (aPr >= 0.1852) p10 = true;
  2163.             if (aPr >= 0.2199) p05 = true;
  2164.             if (aPr >= 0.2597) p02 = true;
  2165.             if (aPr >= 0.2864) p01 = true;
  2166.         break;
  2167.        
  2168.         case 79:
  2169.             if (aPr >= 0.0760) p50 = true;
  2170.             if (aPr >= 0.1439) p20 = true;
  2171.             if (aPr >= 0.1841) p10 = true;
  2172.             if (aPr >= 0.2185) p05 = true;
  2173.             if (aPr >= 0.2581) p02 = true;
  2174.             if (aPr >= 0.2847) p01 = true;
  2175.         break;
  2176.        
  2177.         case 80:
  2178.             if (aPr >= 0.0755) p50 = true;
  2179.             if (aPr >= 0.1430) p20 = true;
  2180.             if (aPr >= 0.1829) p10 = true;
  2181.             if (aPr >= 0.2172) p05 = true;
  2182.             if (aPr >= 0.2565) p02 = true;
  2183.             if (aPr >= 0.2830) p01 = true;
  2184.         break;
  2185.        
  2186.         case 81:
  2187.             if (aPr >= 0.0751) p50 = true;
  2188.             if (aPr >= 0.1421) p20 = true;
  2189.             if (aPr >= 0.1818) p10 = true;
  2190.             if (aPr >= 0.2159) p05 = true;
  2191.             if (aPr >= 0.2550) p02 = true;
  2192.             if (aPr >= 0.2813) p01 = true;
  2193.         break;
  2194.        
  2195.         case 82:
  2196.             if (aPr >= 0.0746) p50 = true;
  2197.             if (aPr >= 0.1412) p20 = true;
  2198.             if (aPr >= 0.1807) p10 = true;
  2199.             if (aPr >= 0.2146) p05 = true;
  2200.             if (aPr >= 0.2535) p02 = true;
  2201.             if (aPr >= 0.2796) p01 = true;
  2202.         break;
  2203.        
  2204.         case 83:
  2205.             if (aPr >= 0.0742) p50 = true;
  2206.             if (aPr >= 0.1404) p20 = true;
  2207.             if (aPr >= 0.1796) p10 = true;
  2208.             if (aPr >= 0.2133) p05 = true;
  2209.             if (aPr >= 0.2520) p02 = true;
  2210.             if (aPr >= 0.2780) p01 = true;
  2211.         break;
  2212.        
  2213.         case 84:
  2214.             if (aPr >= 0.0737) p50 = true;
  2215.             if (aPr >= 0.1396) p20 = true;
  2216.             if (aPr >= 0.1786) p10 = true;
  2217.             if (aPr >= 0.2120) p05 = true;
  2218.             if (aPr >= 0.2505) p02 = true;
  2219.             if (aPr >= 0.2764) p01 = true;
  2220.         break;
  2221.        
  2222.         case 85:
  2223.             if (aPr >= 0.0733) p50 = true;
  2224.             if (aPr >= 0.1387) p20 = true;
  2225.             if (aPr >= 0.1775) p10 = true;
  2226.             if (aPr >= 0.2108) p05 = true;
  2227.             if (aPr >= 0.2491) p02 = true;
  2228.             if (aPr >= 0.2748) p01 = true;
  2229.         break;
  2230.        
  2231.         case 86:
  2232.             if (aPr >= 0.0728) p50 = true;
  2233.             if (aPr >= 0.1379) p20 = true;
  2234.             if (aPr >= 0.1765) p10 = true;
  2235.             if (aPr >= 0.2096) p05 = true;
  2236.             if (aPr >= 0.2477) p02 = true;
  2237.             if (aPr >= 0.2732) p01 = true;
  2238.         break;
  2239.        
  2240.         case 87:
  2241.             if (aPr >= 0.0724) p50 = true;
  2242.             if (aPr >= 0.1371) p20 = true;
  2243.             if (aPr >= 0.1755) p10 = true;
  2244.             if (aPr >= 0.2084) p05 = true;
  2245.             if (aPr >= 0.2463) p02 = true;
  2246.             if (aPr >= 0.2717) p01 = true;
  2247.         break;
  2248.        
  2249.         case 88:
  2250.             if (aPr >= 0.0720) p50 = true;
  2251.             if (aPr >= 0.1364) p20 = true;
  2252.             if (aPr >= 0.1745) p10 = true;
  2253.             if (aPr >= 0.2072) p05 = true;
  2254.             if (aPr >= 0.2449) p02 = true;
  2255.             if (aPr >= 0.2702) p01 = true;
  2256.         break;
  2257.        
  2258.         case 89:
  2259.             if (aPr >= 0.0716) p50 = true;
  2260.             if (aPr >= 0.1356) p20 = true;
  2261.             if (aPr >= 0.1735) p10 = true;
  2262.             if (aPr >= 0.2061) p05 = true;
  2263.             if (aPr >= 0.2435) p02 = true;
  2264.             if (aPr >= 0.2687) p01 = true;
  2265.         break;
  2266.        
  2267.         case 90:
  2268.             if (aPr >= 0.0712) p50 = true;
  2269.             if (aPr >= 0.1348) p20 = true;
  2270.             if (aPr >= 0.1726) p10 = true;
  2271.             if (aPr >= 0.2050) p05 = true;
  2272.             if (aPr >= 0.2422) p02 = true;
  2273.             if (aPr >= 0.2673) p01 = true;
  2274.         break;
  2275.        
  2276.         case 91:
  2277.             if (aPr >= 0.0708) p50 = true;
  2278.             if (aPr >= 0.1341) p20 = true;
  2279.             if (aPr >= 0.1716) p10 = true;
  2280.             if (aPr >= 0.2039) p05 = true;
  2281.             if (aPr >= 0.2409) p02 = true;
  2282.             if (aPr >= 0.2659) p01 = true;
  2283.         break;
  2284.        
  2285.         case 92:
  2286.             if (aPr >= 0.0704) p50 = true;
  2287.             if (aPr >= 0.1334) p20 = true;
  2288.             if (aPr >= 0.1707) p10 = true;
  2289.             if (aPr >= 0.2028) p05 = true;
  2290.             if (aPr >= 0.2396) p02 = true;
  2291.             if (aPr >= 0.2645) p01 = true;
  2292.         break;
  2293.        
  2294.         case 93:
  2295.             if (aPr >= 0.0700) p50 = true;
  2296.             if (aPr >= 0.1327) p20 = true;
  2297.             if (aPr >= 0.1698) p10 = true;
  2298.             if (aPr >= 0.2017) p05 = true;
  2299.             if (aPr >= 0.2384) p02 = true;
  2300.             if (aPr >= 0.2631) p01 = true;
  2301.         break;
  2302.        
  2303.         case 94:
  2304.             if (aPr >= 0.0697) p50 = true;
  2305.             if (aPr >= 0.1320) p20 = true;
  2306.             if (aPr >= 0.1689) p10 = true;
  2307.             if (aPr >= 0.2006) p05 = true;
  2308.             if (aPr >= 0.2371) p02 = true;
  2309.             if (aPr >= 0.2617) p01 = true;
  2310.         break;
  2311.        
  2312.         case 95:
  2313.             if (aPr >= 0.0693) p50 = true;
  2314.             if (aPr >= 0.1313) p20 = true;
  2315.             if (aPr >= 0.1680) p10 = true;
  2316.             if (aPr >= 0.1996) p05 = true;
  2317.             if (aPr >= 0.2359) p02 = true;
  2318.             if (aPr >= 0.2604) p01 = true;
  2319.         break;
  2320.        
  2321.         case 96:
  2322.             if (aPr >= 0.0689) p50 = true;
  2323.             if (aPr >= 0.1306) p20 = true;
  2324.             if (aPr >= 0.1671) p10 = true;
  2325.             if (aPr >= 0.1986) p05 = true;
  2326.             if (aPr >= 0.2347) p02 = true;
  2327.             if (aPr >= 0.2591) p01 = true;
  2328.         break;
  2329.        
  2330.         case 97:
  2331.             if (aPr >= 0.0686) p50 = true;
  2332.             if (aPr >= 0.1299) p20 = true;
  2333.             if (aPr >= 0.1663) p10 = true;
  2334.             if (aPr >= 0.1975) p05 = true;
  2335.             if (aPr >= 0.2335) p02 = true;
  2336.             if (aPr >= 0.2578) p01 = true;
  2337.         break;
  2338.        
  2339.         case 98:
  2340.             if (aPr >= 0.0682) p50 = true;
  2341.             if (aPr >= 0.1292) p20 = true;
  2342.             if (aPr >= 0.1654) p10 = true;
  2343.             if (aPr >= 0.1966) p05 = true;
  2344.             if (aPr >= 0.2324) p02 = true;
  2345.             if (aPr >= 0.2565) p01 = true;
  2346.         break;
  2347.        
  2348.         case 99:
  2349.             if (aPr >= 0.0679) p50 = true;
  2350.             if (aPr >= 0.1286) p20 = true;
  2351.             if (aPr >= 0.1646) p10 = true;
  2352.             if (aPr >= 0.1956) p05 = true;
  2353.             if (aPr >= 0.2312) p02 = true;
  2354.             if (aPr >= 0.2552) p01 = true;
  2355.         break;
  2356.        
  2357.         case 100:
  2358.             if (aPr >= 0.0675) p50 = true;
  2359.             if (aPr >= 0.1279) p20 = true;
  2360.             if (aPr >= 0.1638) p10 = true;
  2361.             if (aPr >= 0.1946) p05 = true;
  2362.             if (aPr >= 0.2301) p02 = true;
  2363.             if (aPr >= 0.2540) p01 = true; 
  2364.     }
  2365.  
  2366.     cout << "For n = " << n << " samples, a DF of " << df << " was used.\n\n"
  2367.         << "    +-------------+-----+-----+-----+-----+-----+-----+\n"
  2368.         << "    | Alpha Error | .5  | .2  | .1  | .05 | .02 | .01 |\n"
  2369.         << "    | Percentage  | 50% | 20% | 90% | 95% | 98% | 99% |\n"
  2370.         << "    | Significant |";
  2371.         if (p50) cout << " Yes |"; else cout << " No  |";
  2372.         if (p20) cout << " Yes |"; else cout << " No  |";
  2373.         if (p10) cout << " Yes |"; else cout << " No  |";
  2374.         if (p05) cout << " Yes |"; else cout << " No  |";
  2375.         if (p02) cout << " Yes |"; else cout << " No  |";
  2376.         if (p01) cout << " Yes |"; else cout << " No  |";
  2377.          
  2378.         cout << "\n    +-------------+-----+-----+-----+-----+-----+-----+\n\n";
  2379.  
  2380.         if (p01) cout << "    Or more formally: r(.01)(" << df << ") = " << pR << ", which can be excellent data.";
  2381.         else if (p02) cout << "    Or more formally: r(.02)(" << df << ") = " << pR << ", which can be excellent data.";
  2382.         else if (p05) cout << "    Or more formally: r(.05)(" << df << ") = " << pR << ", which can be very good data.";
  2383.         else if (p10) cout << "    Or more formally: r(.10)(" << df << ") = " << pR << ", which is sometimes acceptable data.";
  2384.         else if (p20) cout << "    Or more formally: r(.20)(" << df << ") = " << pR << ", which is NOT acceptable data.";
  2385.         else if (p50) cout << "    Or more formally: r(.20)(" << df << ") = " << pR << ", which is effectivly useless data.";
  2386.         else cout << "  Which means your data, no matter what the r, is not significant in any way.";
  2387.         cout << "\n\n";
  2388. }
  2389.  
  2390.  
  2391.  
  2392. bool loadStatsFile(long double arr[], int& numStats, string fileName)
  2393. {
  2394.     ifstream filein;
  2395.     string temp;
  2396.     filein.open(fileName);
  2397.     if (filein.fail( )) return (false);
  2398.     else
  2399.     {
  2400.         cout << "Opened " << fileName << " and reading data.\n";
  2401.         numStats = 0;
  2402.         while(filein.good())
  2403.         {
  2404.             getline (filein, temp);
  2405.             arr[numStats] = atof(temp.c_str());
  2406.             numStats++;
  2407.         }
  2408.     }
  2409.     return true;
  2410. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement