|
Google Site Search | Get RDSS | Sartin Library | RDSS FAQs | Conduct | Register | Site FAQ | Members List | Search | Today's Posts | Mark Forums Read
General Discussion General Horse Racing Discussion |
|
Thread Tools | Display Modes |
06-24-2009, 05:26 PM | #1 |
AlwNW2X
Join Date: Jun 2008
Posts: 24
|
C++ manual entry program
Hi. Not sure exactly where I should post this. The reason I am posting is to get discussion/feedback going on programming pace.
I'm a very rudimentary programmer. I do not know more about programming than is evident in the program I am about to present you with. It's manual entry. I have problems with a mile seventy, and a mile forty. Whenever I put in 8.2 or 8.3, the program shuts down. 8.5 is OK. 6.5 is OK. It doesn't like 8.2, or 8.3. This is why I use 20 for 8.2, and 30 for 8.3. Anyone have any methods to simplify? Here it is: I use the Quincy 2005 compiler.: Distances: 4.5f to 9f: Note that currently I print out F1 F2 F3, total energy and my interpretation of balance. Also energy for each fraction. ::::: //for complete program see the main Quincy 2005 directory #include using namespace std; void fourPointFive(); void five(); void fivePointFive(); void six(); void sixPointFive(); void seven(); void eight(); void eightPointTwo(); void eightPointThree(); void eightPointFive(); void nine(); void menu(); void enterData(); void trackVariantFunction(); void calculate(); void printData(); float firstCall, secondCall, finalCall; float firstFraction, secondFraction, thirdFraction; float finalFraction, rawFinalFraction, beatenLengths; float blFirst, blSecond, blFinal; float EPR, LPR, TPR; float trackVariant; float balance; //energy variables float energy, firstFractionEnergy, secondFractionEnergy, thirdFractionEnergy; int firstCallLength, secondCallLength, finalCallLength; int horseNumber; int routeMarker; int main() { cout << "Note: For 1 mile 40 type in '20' and for 1 mile 70 type in '30' for some strange reason.\n"; cout << "enter 99 to quit"; routeMarker = 0; menu(); } void menu() { int choice; float lengthOfRace; cout << "\nEnter length of race in furlongs: (99 to quit) "; cin >> lengthOfRace; if(lengthOfRace == 4.5) choice = 1; if(lengthOfRace == 5) choice = 2; if(lengthOfRace == 5.5) choice = 3; if(lengthOfRace == 6) choice = 4; if(lengthOfRace == 6.5) choice = 5; if(lengthOfRace == 7) choice = 6; if(lengthOfRace == 8) choice = 7; if(lengthOfRace == 20) choice = 8; if(lengthOfRace == 30) choice = 9; if(lengthOfRace == 8.5) choice = 10; if(lengthOfRace == 9) choice = 11; switch(choice) { case 1: fourPointFive(); break; case 2: five(); break; case 3: fivePointFive(); break; case 4: six(); break; case 5: sixPointFive(); break; case 6: seven(); break; case 7: eight(); break; case 8: eightPointTwo(); break; case 9: eightPointThree(); break; case 10: eightPointFive(); break; case 11: nine(); break; case 99: break; } } void enterData() { cout << "First Call: "; cin >> firstCall; cout << "Second Call: "; cin >> secondCall; cout << "Final Call: "; cin >> finalCall; cout << "Beaten lengths first: "; cin >> blFirst; cout << "Beaten lengths second: "; cin >> blSecond; cout << "Beaten lengths final: "; cin >> blFinal; cout << "Track Variant: "; cin >> trackVariant; trackVariantFunction(); } void trackVariantFunction() { if (trackVariant < 6) { trackVariant = 6; } if (trackVariant > 28) { trackVariant = 28; } if (trackVariant > 18) { trackVariant = (trackVariant - 18) / 5; finalCall = finalCall - (trackVariant * .33); secondCall = secondCall - ((trackVariant / 2)*.33); goto byPass; } if (trackVariant < 16) { trackVariant = (16 - trackVariant) / 5; finalCall = finalCall + (trackVariant * .33); secondCall = secondCall + ((trackVariant / 2) * .33); } byPass: calculate(); } void calculate() { firstFraction = (firstCallLength - (blFirst * 10)) / firstCall; secondFraction = (secondCallLength - ((blSecond - blFirst) * 10)) / (secondCall - firstCall); thirdFraction = (finalCallLength - ((blFinal - blSecond) * 10)) / (finalCall - secondCall); //energy calcs energy = firstFraction + secondFraction + thirdFraction; firstFractionEnergy = firstFraction / energy; secondFractionEnergy = secondFraction / energy; thirdFractionEnergy = thirdFraction / energy; //balance = (firstFractionEnergy - thirdFractionEnergy) * 1000; balance = ((firstFractionEnergy + secondFractionEnergy) - (secondFractionEnergy + thirdFractionEnergy)) * 1000; cout << endl << endl; EPR = ((firstCallLength + secondCallLength) - (blSecond * 10)) / secondCall; LPR = (secondFraction + thirdFraction) / 2; TPR = (EPR + LPR); printData(); } void printData() { //energy cout << "\nfirstFractionEnergy: " << firstFractionEnergy; cout << "\nsecondFractionEnergy: " << secondFractionEnergy; cout << "\nthirdFractionEnergy: " << thirdFractionEnergy; cout << "\ntotalEnergy: " << energy; cout << "\nbalance: " << balance; cout << endl; cout << "\nfirstFraction: " << firstFraction; cout << "\nsecondFraction: " << secondFraction; cout << "\nthirdFraction: " << thirdFraction; /* cout << "\nEPR: " << EPR; cout << "\nLPR: " << LPR; cout << "\nTPR: " << TPR / 2; cout << endl; */ menu(); } void fourPointFive() { cout << "Four and a Half\n"; firstCallLength = 1320; secondCallLength = 1320; finalCallLength = 330; enterData(); } void five() { cout << "five\n"; firstCallLength = 1320; secondCallLength = 1320; finalCallLength = 660; enterData(); } void fivePointFive() { cout << "five and a Half\n"; firstCallLength = 1320; secondCallLength = 1320; finalCallLength = 990; enterData(); } void six() { cout << "six\n"; firstCallLength = 1320; secondCallLength = 1320; finalCallLength = 1320; enterData(); } void sixPointFive() { cout << "six and a Half\n"; firstCallLength = 1320; secondCallLength = 1320; finalCallLength = 1650; enterData(); } void seven() { cout << "seven\n"; firstCallLength = 1320; secondCallLength = 1320; finalCallLength = 1980; enterData(); } void eight() { cout << "eight\n"; routeMarker = 5; firstCallLength = 2640; secondCallLength = 1320; finalCallLength = 1320; enterData(); } void eightPointTwo() { cout << "a mile 40\n"; routeMarker = 5; firstCallLength = 2640; secondCallLength = 1320; finalCallLength = 1440; enterData(); } void eightPointThree() { cout << "a mile seventy\n"; routeMarker = 5; firstCallLength = 2640; secondCallLength = 1320; finalCallLength = 1530; enterData(); } void eightPointFive() { cout << "a mile and a sixteenth\n"; routeMarker = 5; firstCallLength = 2640; secondCallLength = 1320; finalCallLength = 1650; enterData(); } void nine() { cout << "nine\n"; routeMarker = 5; firstCallLength = 2640; secondCallLength = 1320; finalCallLength = 1980; enterData(); } |
06-24-2009, 05:29 PM | #2 |
AlwNW2X
Join Date: Jun 2008
Posts: 24
|
Note on top the #include statement should read: #include
|
06-24-2009, 05:31 PM | #3 |
AlwNW2X
Join Date: Jun 2008
Posts: 24
|
Angle bracket iostream angle bracket. This outfit here does not read angle brackets. |
06-24-2009, 05:32 PM | #4 |
Grade 1
Join Date: Jun 2005
Posts: 7,014
|
"Tiger"
For mile 40 try: 8.181 For mile 70 try: 8.318 see if that helps
__________________
"Grampy I'm talking to you!" |
06-24-2009, 05:38 PM | #5 |
AlwNW2X
Join Date: Jun 2008
Posts: 24
|
I'll try that RichieP. Boy I must say that you have a quick mind. I posted and you replied within about 3 minutes.
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Getting started | Bill V. | Welcome to the Sartin Methodology | 24 | 10-16-2014 10:31 PM |
Purchasing Manual Data Input RDSS | smilingtiger | RDSS | 3 | 04-28-2009 08:19 AM |
old program discoveries | Tim Y | General Discussion | 24 | 12-30-2008 01:59 PM |
Yellow Manual | Bill V. | Manuals | 0 | 12-07-2008 07:38 PM |
Best Sartin Program | shoeless | Velocity Programs | 23 | 10-11-2008 04:37 AM |