//Allan Clark Alcube.cpp// //Oct 9/02// //To Calculate and make a chart of one number to another of it's square, square root, and cube// #include //The library call for input/output// #include //The library call for input/output manipulation// #include //The library call for clrscr()// #include //The library call used to manipulate string variables. (strcpy)// #include //The library call to use math equations (sqrt) // #include //The library call to acquire the system's date// int main(void) { char yes; // Declaration of Local Variables // int ref, start, end; double sqr,sqroot, cube; //Fowler Statement// cout << endl << endl; cout << " ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*" << endl; cout << " ~This Program will calculate and make a chart*" << endl; cout << " ~ of one number to another of its square, *" << endl; cout << " ~ square root, and cube *" << endl; cout << " ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*" << endl; cout << endl; cout << " // Allan Clark - Programmer //" << endl << endl; cout << " Press Any Key to Continue"; getch(); // gets character // start: clrscr(); //Clears the fowler screen and goes to the input screen// time_t t=time(NULL); cout << " " << ctime(&t)<< endl << endl; //Displays the time// cout << "\tThis program will not accept any numbers that\t\t\t\t\t are negative and that aren't integers."; cout << endl << endl; cout << " Squares Roots and Cubes " << endl; cout << " ~~~~~~~~~~~~~~~~~~~~~~~" << endl; cout << endl; cout << " Please enter your starting number: "; cin >> start; cout << endl << endl; cout << " Please enter your ending number: "; cin >> end; if(start < 0) //If the starting number is a negative then the program restarts// { goto start; } if(start > end) //If the starting number is a larger number than the ending number then the program restarts// { goto start; } clrscr(); //Clears the input screen and goes to the output screen// cout << " " << ctime(&t)<< endl << endl; //Displays the time// cout << " \t\t\t Squares - Roots - Cubes" << endl; cout << " \t\t\t ~~~~~~~~~~~~~~~~~~~~~~~" << endl; cout << "\t Reference \t Squared \t Square Root \t Cubed" << endl; cout << "\t ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl << endl; for(ref = start; ref <=end; ref++) { sqr = ref * ref; sqroot = sqrt(ref); cube = ref * ref * ref; cout << setiosflags(ios::fixed | ios::right); cout << setprecision(0); cout << setw(15) << ref << setw(15) << sqr; cout << setprecision(2) << setw(20) << sqroot << setw(10) << setprecision(0) << cube; cout << endl; } cout << endl << "\t\t\t\t -Thank You-" << endl << endl; cout << "\t Do you wish to use another chart? (y/n): "; cin >> yes; if(yes == 'y') // If statement that asks user if (s)he wants to make another chart // { goto start; } return 0; }