//Bobby McDonald //CS15 Conway // 2-14-01 //Assignment Number 2 //This program solves a polynomial with user inputs #include //for interactive IO #include //for getchar at end const int MaxDegree=10; //maximum array size template type1 InputArray(type1 TheArray[], type1 x, int degree) { //user input array for (int count=0; count<=degree; count++) { if (count != degree) { cout<<"what's coefficient # "<>TheArray[count]; } else { cout<<"what's the last number to add? "<>TheArray[count]; //last coefficient } } calculate(TheArray, x, degree); //calls overloaded function return 0; } void calculate(int TheArray[], int X, int degree) //for ints { int sum=(TheArray[0]*X) + TheArray[1]; for (int count=2; count<=degree; count++) { sum = (sum*X) + TheArray[count]; } cout<<"The sum is: "<>IntOrFloat; while (again) { cout<<"How many degrees is your polynomial?"<>degree; if (degree>MaxDegree) { cout<<"it has to be "<>X1; InputArray(TheArray1, X1, degree); } if (IntOrFloat == 2) { cout<<"what's x?"<>X2; InputArray(TheArray2, X2, degree); } }