code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
Terms of Agreement:
By using this code, you agree to the following terms...
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for langauges that allow it) freely and with no charge.
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
//
#include
float x, y;
int main ()
{
bool done = false;
int x,y,z;
int a,b,c,d;
for(;;)
{
cout << "\nWelcome To Batting Avg Calculator By Matt Belair!\n";
cout<<"Version 1.0 Compiled May 17. 2k1 AD\n";
cout << "\nMain Menu- Choose an option\n";
cout << "[1] Calculate Your Batting Avg.\n";
cout << "[2] Calculate Pitchers Era\n";
cout << "[3] Quit\n";
cin >> z;
switch (z)
{
case 1:
cout << "\nEnter Number of Hits:\t";
cin >> x;
cout << "Enter Number of At Bats:\t";
cin >> y;
cout <<"Batting avg:\t\t"<<(float)x/y< break; case 2: cout << "\nEnter The Number of Earned Runs given up:\t"; cin>>a; cout << "\nEnter number of Innings Pitched:\t"; cin>>b; cout << "\nEnter number of innings in a standard game:\t"; cin >>c; cout <<"ERA:\t\t"<<(float)a/b*c< break; case 3: done = true; break; default: cout << "Make another Selection"; break; } if (done) break; } return 0; }