// Andrew Keeler // 294-72-7437 // younger 2:00 wed // PA #6 /* this program will simulate a forest fire. The amount of trees is determined by the user and the trees randomally appear.*/ //*************************************************************** //preprocessor directives #include // for getch #include // for cin, and cout #include // for graphics #include // for exit #include // for string functions #include // for random #define BGIHOME "G:\\WIN95\\APPS\\BORLAND\\BC5\\BGI" // graphics library //**************************************************************** // function declarations //**************************************************************** // MAIN void main() { float grade_average,average_time, fastest_time, howmanythat_post, firsts, seconds, thirds, starts, what_post, total = 0, time, post_time, rating, j,k; char high_grade, low_grade; int x,y; float grade, gradel,i, places; char p_or_m; char breaking_from, oop, rail_runner; char dah; dah = 'y'; while (dah == 'y') { cout << "how many times "; cin >> x; for (y=1; y <= x; y++ ) { cout << "Enter time " ; cin >> time; total += time; } average_time = total / x; total = 0; cout << "What is the dogs fastest time "; cin >> fastest_time; cout<< "what post is he running from today "; cin >> what_post; cout << "how many times has the dog run near that post "; cin >> x; for (y=1; y <= x; y++) { cout << "Time: "; cin >> time; total += time; } post_time = total / x; cout << "how many first does your dog have "; cin >> firsts; cout << "seconds "; cin >> seconds; cout << "thirds "; cin >> thirds; cout << "starts "; cin >> starts; cout << "Is your dog a rail runner y/n "; cin >> rail_runner; cout << "is your dog run m.id w.ide or i.nside "; cin >> breaking_from; cout << "What is your dogs high grade "; cin >> high_grade; cout << "low grade "; cin >> low_grade; rating =0; i = 0; if (post_time <= average_time) { if (post_time + 5 <= average_time) i += 1; if ((post_time + 2) <= average_time) i += 1; if ((post_time + .75) <= average_time) i += 1; if ((post_time + .50) <= average_time) i += 1; if ((post_time + .25) <= average_time) i += 1; } else i += +1; if (post_time > average_time) i = 12 * (average_time - post_time); if (high_grade == 'a') grade = 6; if (high_grade == 'b') grade = 5; if (high_grade == 'c') grade = 4; if (high_grade == 'd') grade = 3; if (high_grade == 'e') grade = 2; if (high_grade == 'm'); grade = 1; //i = (post_time / average_time) * 20; rating += i; if (high_grade == 'a') grade = 6; if (high_grade == 'b') grade = 5; if (high_grade == 'c') grade = 4; if (high_grade == 'd') grade = 3; if (high_grade == 'e') grade = 2; if (high_grade == 'm'); grade = 1; if (low_grade == 'a') gradel = 6; if (low_grade == 'b') gradel = 5; if (low_grade == 'c') gradel = 4; if (low_grade == 'd') gradel = 3; if (low_grade == 'e') gradel = 2; if (low_grade == 'm'); gradel = 1; grade_average = (low_grade + high_grade) / 2; places = ((firsts * 3) + (seconds * 2) + (thirds * 1)) / starts; rating += ((grade_average * places) / 4); if ((what_post > 0) && (what_post < 4)) if (rail_runner == 'y') rating += 2; if (breaking_from == 'w') if ((what_post < 9) && (what_post > 5)) rating += 1; if (breaking_from == 'm') if ((what_post < 7) && (what_post > 2)) rating += 1; if (breaking_from == 'i') if ((what_post > 4) && (what_post > 0)) rating+=1; cout << "your dogs rating = " << rating << endl; getch(); cout << "Do another rating y or n "; cin >> dah; } }