Try out my calculator!

Just completed my 3rd c++ project, and by far the biggest. Anyways it is a calculator that has the main functions;

1.) finds the zeroes of a "ax^2 + bx +c" polynomial using the quadratic function (takes up about 1-2% of the source code)

2.) divided divisors of degree's ^1, ^2, and 3^ into dividends of degree ^3 and ^4, i made this by following the sequence of steps one would use if they were dividing by hand, and I ended up with over 50 if's nested with one another for this function alone.. (takes about roughly 96% of source code)

3.) various functions dealing with circles.. circumference, area, speed whilst traversing a circle.


anyways if you want to try it out and try to find flaws or just check my answers, please do! code is pretty long so it will take up a few posts but I did
a lot of random testing on it trying to gauge it from all angles and i think it works nicely.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#include <iostream>
#include "conio.h"
#include <string>
#include <cmath>
#include <math.h>

using namespace std;

// this variable is to choose what function a person wants to do
int mainfunction = 0;


/* !!!!!!!!!!These next variables are for the division of polynomials function !!!!!!!!!!!!!!!!!*/
 
int checkinputspecial;
int firstchoice = 0; // determines degree of divident (thing being divided)
int secondchoice = 0; // determines degree of divisor
int dive [7] = { 0, 0, 0, 0, 0, 0, 0 } ; // this is your dividend, if its a 3 degree polynomial, you will only use 3 of the alloted variables etc.
int divi [6] = { 0, 0, 0, 0, 0, 0 }; // this is your divisor, to be used for any degree divisor
int quo [6] = { 0, 0, 0, 0, 0, 0 };// this is going to be your quotient that ends up on top of the dividend
int line [8][7]; /* These are your subtraction lines. the first box denotes sequence from top to bottom. 
								   second box denotes space in that line from left to right, as if you were doing this division by hand
								   and drew a graph around the various inputs under the dividend*/
int abso [5];// these are to be used for when you need to convert a 'line [x][x]' into its absolute value
int rem2 [3] ;// no use yet
int result [7] ;// no use yet

int check_input1 = 1;// to find out if dive input is correct
int check_input2 = 1;// to find out if divi input is correct
int dive1 [5];// not used yet




/* !!!!!!these next variables are for the quadratic formula function!!!!!!!!!!!!!*/

float a, b, c;

double d = (b / -1);
double e = (b * b);
double f = 4 * a * c;
double t = e - f;
double y = sqrt(t / -1);
double u = d + y;
double g = 2 * a;
double h = (d + y) / g;

/* these variables are for the circle function!!!!!!!! */



int circlefunction;
double radius = 0;
double PI = 3.1415932;
double circumferance = (2 * PI * radius);
double area = (PI * (radius * radius));
double timesaround = 0;
double time = 0;
double totaldistance = 0;
double speed = 0;








int main() 
{

	cout << "                            hello      \n \n \n " << endl;
	cout << "                  welcome to Johnny's calculator \n" << endl;
	cout << "  this calculator can do a few things and more are always being added \n \n" << endl;
	cout << " right now we can either \n" << endl;
	cout << "1.) use the quadratic formula to find the zeroes of a quadratic polynomial \n " << endl;
	cout << "2.) divide polynomials of various degree's into one another \n" << endl;
	cout << "3.) do equations based on the relations of a circle \n \n " << endl;
	cout << "please choose what you would like to do ( 1 2, 3 ) " << endl;
	cin >> mainfunction;
	cout << " \n \n \n \n \n \n " << endl;

	if (mainfunction < 1 && mainfunction > 3)
	{
		return main();
	}

	if (mainfunction == 1)
	{
		cout << "   today we will find the zeroes of a quadratic using the quadratic formula" << endl;
cout << "                         it will be in this form. " << endl;
	cout << "             \n \n   Ax^2 + Bx + C  \n \n \n" << endl;
cout << "please enter your 'a' term" << endl;
cin >> a;
cout << "please enter your b term" << endl;
cin >> b;
cout << "please enter your constant (c term)" << endl;
cin >> c;

cout << "your polynomial is  " << a <<"x^2 +" << b << "x +" << c << endl;



double d = (b / -1);

double e = (b * b);
double f = 4 * a * c;
double t = e - f;
double y =  sqrt (t / -1);
double u = sqrt (t);
double g = 2 * a;

if (t < 0)
{
	cout << " the zero's of your polynomial are " << d << " +/- "  << y << "i" << "/" << g << " \n \n " << endl;
cout << "this reduces to      " << d / g << " + " << y << "i" << " / " << g << " \n \n " <<endl;
cout << "and                  " << d / g << " - " << y << "i" << "/" << g << " \n \n \n \n \n \n \n \n" << endl;
system("PAUSE");
}
if (t > 0) 
{
cout << " the zero's of your polynomial are      " << d / g << " +/- "  << u / g << " \n \n " << endl;
	cout << "this reduces to                   " << (d / g) + ( u / g) << "  and " << (d / g) - (u / g) << " \n \n \n" << endl;
system("PAUSE");
}

return main();



	}


		if (mainfunction == 2)
		{

	cout << "        today we will be dividing two polynomials together \n" ;
	cout << " \n   ";
	cout << "                  it will be in this form; \n" ;
	cout << " \n   ";
	cout << "                ax^3+ bx^2+ cx+ d / ax^2+bx+c  \n " ;
	cout << " \n" ;
	cout << "with varying numbers for both the degree of the polynomial and the coeffecients \n" ;
	cout << " \n";
		cout << "       please select the degree of your dividend ( 2 < x < 4 ) \n" << endl;
		cout << "            ( the dividend is the number being divided into )     " << endl; // select degree of dividend
		cout << "      ( the divisor is the number the dividend is divided by ) " << endl;
		cout << " \n ";
		cin >> firstchoice; 
		if (firstchoice < 2 || firstchoice > 4) // incase they enter a degree to high for my programming skills
		{
			cout << endl << "please choose a dividend of degree 3 or 4 "; cin >> firstchoice; 
				
		}
		if (firstchoice == 3) 
		{
			cout << "what is the degree of your divisor? (1 or 2) \n";
			cin >> secondchoice;

			if (secondchoice == 1) /* this is for a 3rd degree plynml being divided by a 1st degree plynml, in the form "Ax+B"*/
			{ 
				cout << "you said your dividend is a 3rd degree polynomial, this will be in the form \n" ;
				cout << " \n ";
				cout << "               Ax^3 + Bx^2 + Cx + D  \n " ;
					cout << "D is your constant term  \n";
				cout << "   \n ";	
				cout << "please enter in the corresponding coeffecients as they logically \n " << endl;
					cout << "appear on screen. numbers must be whole intergers\n " << endl ;
					cout << " \n " << endl;

					cout << "please enter the proper coeffecients for the corresponding terms below \n";
					cout << " \n ";
					cout <<"                  Ax^3 + Bx^2 + Cx + D \n \n \n";
					cout << " \n ";
					cout << "A term ="; cin >> dive [0]; cout << dive [0] << endl;
						cout << "   \n ";
						cout << "B term ="; cin >> dive [1];  cout << dive [1] << endl;
						cout << "   \n ";
						cout << "C term ="; cin >> dive [2]; cout << dive [2] << endl;
			            cout << "   \n ";
						cout << "D term (constant) ="; cin >> dive [3]; cout << dive [3] << endl;
						cout << " \n ";
			cout << "your polynomial is \n";
			cout << " \n ";
			cout << "         " << dive [0] << "x^3 + " << dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << endl;

			cout << "is this correct (0 for NO, anything else for YES)" << endl;// to make sure input is correct
			cin >> check_input1;
			cout << " \n \n \n \n \n \n \n " << endl;
			if (check_input1 == 0)
			{
				cout << "re-enter your A,B,C, and D term, one by one. hitting enter after each one \n" << endl;
				cin >> dive [0];
				cin >> dive [1];
				cin >> dive [2];
				cin >> dive [3];

				cout << "your  dividend polynomial is \n";
			cout << dive [0] << "x^3 + " << dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << endl;
			cout << " \n \n \n \n \n \n \n " << endl;
			check_input1 = 2;/* makes it so whatever they enter in the second time gets automatically passed onto the divisor
							 input*/
			
			}
			

Last edited on

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
if (check_input1 > 0)
			{ 
				
				cout << "you have stated that your divisor is a 1st degree polynomial /n" << endl;
				cout << "this will be in the form \n" << endl;
				cout << "   \n ";
				cout << " Ax + B \n" << endl;
				cout << "\n";
				cout << "please enter your A term"; cin >> divi [0]; cout << divi [0] << endl;
				cout << "   \n ";
				cout << "please enter your b term"; cin >> divi [1]; cout << divi [1] << endl;
			

				cout << "your divisor polynomial is \n";
			cout << divi [0] << "x + " << divi [1] << endl; 

			cout << "is this correct (0 for NO anything else for YES)" << endl;// to make sure input is correct
			cin >> check_input2;
			cout << " \n \n \n \n \n \n \n " << endl;
			if (check_input2 == 0)
			{
				cout << "re-enter your A and B terms, one by one. hitting enter after each one \n" << endl;
				cin >> divi [0];
				cin >> divi [1];
			

				cout << "                your divisor polynomial is \n";
			cout << "               " << divi [0] << "x + " << divi [1] << endl;
			cout << " \n \n \n \n \n \n \n " << endl;
			check_input2 = 2;
			}
			check_input2 = 2;
			if (check_input2 != 0)
				{

quo [0] = (dive [0] / divi[0]);
line [0][0] = (quo [0] * divi [0]);
line [0][1] = (quo [0] * divi [1]); // now I have the first line
line [1][0] = (dive [0] - line [0][0]); 
line [1][1] = (dive [1] - line [0][1]);
line [1][2] = dive [2];// bring down the next divedent component 

if (line [1][1] == 0 && line [1][0] == 0) /* in the off chance the two first terms are eliminated  */
{

	quo [1] = line [1][2] / divi [0];
	line [2][2] = quo [1] * divi [0];
	line [2][3] = quo [1] * divi [1];
	line [3][2] = line [1][2] - line [2][2];
	line [3][3] = dive [3] - line [2][3];
	

	cout << dive [0] << "x^3 + " << dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << " / "  << divi [0] << "x + " << divi [1]  << endl;
cout << " \n = " << quo [0] << "x^2" << " + " << quo [1]  <<  "    +  (" << line [3][2] <<  "x +" << line [3][3] << 
	") / "  << divi [0] << "x + " << divi [1]  << endl;
cout << " \n \n \n \n \n \n "  << endl;
     system ("PAUSE");
	 return main ();
}

 abso [0] = abs (line [1][1]);

 if (line [1][0] == 0 && line [1][1] != 0)
  {
	  if (divi [0] <= abso [0])/*if the first term of the divisor can divide into the new dividend  */
	  {
quo [1] = (line [1][1] / divi [0]);
line [2][0] = (quo [1] * divi [0]);
line [2][1] = (quo [1] * divi [1]);
line [3][0] = ( line [1][1] - line [2][0]);
line [3][1] = (line [1][2] - line [2][1]);
line [3][2] = dive [3];
abso [0] = abs (line [1][1]);


	  }
  if (divi [0] > abso [0])/*on the off chance it(^) can't, auto displays the large remainder  */
  {
cout << dive [0] << "x^3 + " <<		dive [1] << "x^2 + " << dive [2] << "x + " << dive [3]
	  << " / "  << divi [0] << "x + " << divi [1]  << endl;

cout << " \n = " << quo [0] << "x^2" << "      +      ("  << line [1][1] << "x^2" << " + " << dive [2] << "x + " << 
	dive [3] << ") / "  << divi [0] << "x + " << divi [1]  << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
  return main(); 
  }


if (line [3][0] == 0 )
 {
quo [2] = line [3][1] / divi [0];
line [4][1] = quo [2] * divi [0];
line [4][2] = quo [2] * divi [1];
line [5][1] = line [3][1] - line [4][1];
line [5][2] = line [3][2] - line [4][2];
 


if ( line [5][1] == 0 && line [5][2] != 0 )// put's out remainder right away because it is now a lower degree than our divisor
   {
cout << dive [0] << "x^3 + " <<		dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << " / "  << divi [0] << "x + " << divi [1]  << endl;
cout << " \n = " << quo [0] << "x^2" << " + " << quo [1] << "x" << " + " << quo [2] << "      +     ("  << line [5][2] << ") / "  << divi [0] << "x + " << divi [1]  << endl;
cout << " \n \n \n \n \n \n "  << endl;   
system ("PAUSE");
	 return main ();

   }

if ( line [5][2] == 0 && line [5][2] == 0 )// same as above, different quantities in the remainder.
      {
       cout << dive [0] << "x^3 + " <<		dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << " / "  << divi [0] << "x + " << divi [1]  << endl;
cout << " \n = " << quo [0] << "x^2" << " + " << quo [1] << "x" << " + " << quo [2] << endl; 
cout << " \n \n \n \n \n \n "  << endl;      
system ("PAUSE");
	 return main ();

      }


/* these next lines are for any occurances where our terms dont divide perfectly, and there
is a remainder left under the dividend with a smaller absolute value of the constant than the first term of the divisor.
since we are not working in decimals, we will consider the solution factored fully and present it as such*/


			if (line [5][1] != 0)
      {
cout << dive [0] << "x^3 + " << dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << " / "  << divi [0] << "x + " << divi [1]  << endl;
cout << " \n = " << quo [0] << "x^2" << " + " << quo [1] << "x" << " + " << quo [2] << "    +    (" << line [5][1] << " x + " << line [5][2] 
<< ") / "  << divi [0] << "x + " << divi [1]  << endl;
cout << " \n \n \n \n \n \n "  << endl;      
system ("PAUSE");
	 return main ();
			
	   }

 }
 if (line [1][0] != 0 )
{
cout << dive [0] << "x^3 + " << dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << " / "  << divi [0] << "x + " << divi [1]  << endl;
cout << " \n = " << quo [0] << " x^2" <<  "      +     (" << line [1][0] << " x^3 + " << line [1][1] << " x^2 + " << line [1][2] << "x + " << dive [3] 
<< ") / "  << divi [0] << "x + " << divi [1]  << endl;
cout << " \n \n \n \n \n \n "  << endl;
system ("PAUSE");
 return main();
 
 }
}
if (line [3][0] != 0 )
    {
cout << dive [0] << "x^3 + " << dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << " / "  << divi [0] << "x + " << divi [1]  << endl;
cout << " \n = " << quo [0] << "x^2" << " + " << quo [1] << "x " << "    +    (" << line [3][0] << " x^2 + " << line [3][1] << " x + " << line [3][2] <<
	") / "  << divi [0] << "x + " << divi [1]  << endl;
cout << " \n \n \n \n \n \n "  << endl;
system ("PAUSE");
	 return main ();
}
     
				}
			}
			
			
			}

			




			if (secondchoice == 2) /* this is for a 3rd degree plynml being divided by a quad plynml, copy this code and adjust accordingly to 
								   make it easier in the future*/
			{ 
				cout << "you said your dividend is a 3rd degree polynomial, this will be in the form \n" ;
				cout << " \n ";
				cout << "                     Ax^3 + Bx^2 + Cx + D   " << "  \n";
				cout << "                  ( D is your constant term ) \n ";	
				cout << " \n ";
				cout << "    please enter in the  corresponding coeffecients as they logically  \n " << endl ;
				cout << "                          appear on screen. \n ";	
				cout << "                numbers must be whole intergers \n" << endl;
				cout << " \n ";
				cout << " \n ";	
				cout << "please enter the proper coeffecients for the corresponding terms below \n";
					cout <<"                  Ax^3 + Bx^2 + Cx + D \n \n \n";
						cout << "A term ="; cin >> dive [0]; cout << dive [0] << endl;
						cout << "B term ="; cin >> dive [1];  cout << dive [1] << endl;
						cout << "C term ="; cin >> dive [2]; cout << dive [2] << endl;
			cout << "D term (constant) ="; cin >> dive [3]; cout << dive [3] << endl;

			cout << "your polynomial is \n";
			cout << " \n ";
			cout << "            " << dive [0] << "x^3 + " << dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << endl;
			cout << " \n ";
			cout << " \n ";
			cout << "is this correct (0 for NO anything else for YES)" << endl;// to make sure input is correct
			cin >> check_input1;
			cout << " \n \n \n \n \n \n \n " << endl;

		
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
if (check_input1 == 0)
			{
				cout << "re-enter your A,B,C, and D term, one by one. hitting enter after each one \n" << endl;
				cin >> dive [0];
				cin >> dive [1];
				cin >> dive [2];
				cin >> dive [3];

				cout << "your  dividend polynomial is \n";
			cout << dive [0] << "x^3 + " << dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << endl;
			cout << " \n \n \n \n \n \n \n " << endl;
			check_input1 = 2;/* makes it so whatever they enter in the second time gets automatically passed onto the divisor
							 input*/

			}
			if (check_input1 > 0)
			{
				cout << "you have stated that your divisor is a 2nd degree polynomial /n" << endl;
				cout << "this will be in the form \n" << endl;
				cout << "Ax^2 + Bx + C \n" << endl;
				cout << "\n";
				cout << "please enter your A term"; cin >> divi [0]; cout << divi [0] << endl;
				cout << "please enter your b term"; cin >> divi [1]; cout << divi [1] << endl;
				cout << "please enter your c term"; cin >> divi [2]; cout << divi [2] << endl;

				cout << "your divisor polynomial is \n";
			cout << divi [0] << "x^2 + " << divi [1] << "x^ + " << divi [2] << endl;

			cout << "is this correct (0 for NO anything else for YES)" << endl;// to make sure input is correct
			cin >> check_input2;

			cout << " \n \n \n \n \n \n \n " << endl;


			if (check_input2 == 0)
			{
				cout << "re-enter your A,B, and C term, one by one. hitting enter after each one \n" << endl;
				cin >> divi [0];
				cin >> divi [1];
				cin >> divi [2];

				cout << "your divisor polynomial is \n";
			cout << divi [0] << "x^2 + " << divi [1] << "x^ + " << divi [2] << endl;
			cout << " \n \n \n \n \n \n \n " << endl;
			check_input2 = 2;
			}
			if (check_input2 > 0)
				{
					cout << "ok, we will now divide \n" << endl;
			 cout << dive [0] << "x^3 + " << dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << " / " 
				 << divi [0] << "x^2 + " << divi [1] << "x^ + " << divi [2] << endl;

			
			 

/*ok, so here we are at the point where the math starts. We are right now inside the 3rd deg. dividend bracket,
			 inside the 2nd deg. divisor bracket, past 2 points to check data input*/

			 quo [0] = dive [0] / divi [0];
			 line [0][0] = quo [0] * divi [0];
			 line [0][1] = quo [0] * divi [1];
			 line [0][2] = quo [0] * divi [2];
			 line [1][0] = dive [0] - line [0][0];
			 line [1][1] = dive [1] - line [0][1];
			 line [1][2] = dive [2] - line [0][2];
			 line [1][3] = dive [3];

			 if (line [1][0] != 0)
			   {
				 cout << " \n";
			 cout << "\n";
			 cout << "\n";
			 cout << dive [0] << "x^3 + " << dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << " / " 
				 << divi [0] << "x^2 + " << divi [1] << "x^ + " << divi [2] << endl;
			 cout << "\n";
		     cout << " = " << quo [0] << "x     +     (" << line [1][0] << "x^3 +  " << line [1][1] << "x^2 + " 
				 << line [1][2] << "x + " << line [1][3] << ")  / " <<  divi [0] << "x^2 + " << divi [1] << "x^ + " << divi [2] << endl;
			 cout << " \n \n \n \n \n \n "  << endl;
			 system("PAUSE");
			   return main();
			    }
			 if (line [1][0] == 0 && line [1][1] == 0)
			   {
				    cout << " \n";
			 cout << "\n";
			 cout << "\n";
			 cout << dive [0] << "x^3 + " << dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << " / " 
				 << divi [0] << "x^2 + " << divi [1] << "x^ + " << divi [2] << endl;
			 cout << "\n";
		     cout << " = " << quo [0] << "x     +     (" << line [1][2] << "x + " 
				 << line [1][3] <<  ")    / " <<  divi [0] << "x^2 + " << divi [1] << "x^ + " << divi [2] << endl;
			 cout << " \n \n \n \n \n \n "  << endl;
			 ("PAUSE");
			 return main();
			 }
			    if (line [1][0] == 0 && line [1][1] != 0)
				{
					abso [0] = abs (line [1][1]);

					if (divi [0] > abso [0])/*on the off chance it can't, auto displays the large remainder  */
  {
cout << dive [0] << "x^3 + " <<		dive [1] << "x^2 + " << dive [2] << "x + " << dive [3]
	  << " / "  << divi [0] << "x + " << divi [1] << " + " << divi [2] << endl;

cout << " \n = " << quo [0] << "x" << "      +      ("  << line [1][1] << "x^2" << " + " << line [1][2] << "x + " << 
	line [1][3] << ") / "  << divi [0] << "x^2 + " << divi [1] << "x + " << divi [3] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
   return main();
					
   }
                  if (divi [0] <= abso [0])
				  {
					quo [1] = line [1][1] / divi [0];
					line [2][1] = quo [1] * divi [0];
					line [2][2] = quo [1] * divi [1];
					line [2][3] = quo [1] * divi [2];
					line [3][1] = line [1][1] - line [2][1];
					line [3][2] = line [1][2] - line [2][2];
					line [3][3] = line [1][3] - line [2][3];
				   
					if (line[3][1] != 0)
				   { 
			 cout << " \n";
			 cout << "\n";
			 cout << "\n";
			 cout << dive [0] << "x^3 + " << dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << " / " 
				 << divi [0] << "x^2 + " << divi [1] << "x^ + " << divi [2] << endl;
			 cout << "\n";
		     cout << " = " << quo [0] << "x + " << quo [1] <<   "     +     (" << line [3][1] << "x^2 +  " << line [3][2] << "x + " 
				 << line [3][3] << ")  / " <<  divi [0] << "x^2 + " << divi [1] << "x^ + " << divi [2] << endl;
			 cout << " \n \n \n \n \n \n "  << endl;
			 system("PAUSE");
			 return main();

				   }
				if (line [3][1] == 0 && line [3][2] != 0)
				   {
				cout << " \n";
			 cout << "\n";
			 cout << "\n";
			 cout << dive [0] << "x^3 + " << dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << " / " 
				 << divi [0] << "x^2 + " << divi [1] << "x^ + " << divi [2] << endl;
			 cout << "\n";
		     cout << " = " << quo [0] << "x + " << quo [1] <<   "     +     (" << line [3][2] << "x + " 
				 << line [3][3] << ")  / " <<  divi [0] << "x^2 + " << divi [1] << "x^ + " << divi [2] << endl;
			 cout << " \n \n \n \n \n \n "  << endl;
			 system("PAUSE");
			 return main();
                  }

				if (line [3][1] == 0 && line [3][2] == 0)
				{
					if (line [3][3] != 0)
					{
					cout << " \n";
			 cout << "\n";
			 cout << "\n";
			 cout << dive [0] << "x^3 + " << dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << " / " 
				 << divi [0] << "x^2 + " << divi [1] << "x^ + " << divi [2] << endl;
			 cout << "\n";
		     cout << " = " << quo [0] << "x + " << quo [1] <<   "     +     ("<< line [3][3] << ")  / " <<  divi [0] << "x^2 + " << divi [1] << "x^ + " << divi [2] << endl;
			 cout << " \n \n \n \n \n \n "  << endl;
			 system("PAUSE");
			 return main();
				    }
				if (line [3][3] == 0)
				    {
						cout << " \n";
			 cout << "\n";
			 cout << "\n";
			 cout << dive [0] << "x^3 + " << dive [1] << "x^2 + " << dive [2] << "x + " << dive [3] << " / " 
				 << divi [0] << "x^2 + " << divi [1] << "x^ + " << divi [2] << endl;
			 cout << "\n";
		     cout << " = " << quo [0] << "x + " << quo [1] <<  endl;
			 cout << " \n \n \n \n \n \n "  << endl;
			 system("PAUSE");
				return main();   
				}

				}
				}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166

			
			 
		

			}// close for correct divisor info

			} //close for correct dividend info

			}





			}// close for divisors of 2
		} // if for dividends of 3
		
		if (firstchoice == 4) 
		{
			cout << "what is the degree of your divisor? (1, 2, or 3) \n";
			cin >> secondchoice;

			if (secondchoice > 3 || secondchoice < 1)
			{
				cout << "please enter either 1,2 or 3. ( this represents the highest power of 'x' in your divisor)" << endl;
				cin >> secondchoice;
			}

			if (secondchoice == 3)
			{
				cout << "you said your dividend is a 4rd degree polynomial, this will be in the form \n" ;
				cout << " \n ";
				cout << "               Ax^4 + Bx^3 + Cx^2 + Dx + E  \n " ;
					cout << "E is your constant term  \n";
				cout << "   \n ";	
				cout << "please enter in the corresponding coeffecients as they logically \n " << endl;
					cout << "appear on screen. numbers must be whole intergers\n " << endl ;
					cout << " \n " << endl;

					cout << "please enter the proper coeffecients for the corresponding terms below \n";
					cout << " \n ";
					cout <<"                Ax^4 + Bx^3 + Cx^2 + Dx + E \n \n \n";
					cout << " \n ";
					cout << "A term ="; cin >> dive [0]; cout << dive [0] << endl;
						cout << "   \n ";
						cout << "B term ="; cin >> dive [1];  cout << dive [1] << endl;
						cout << "   \n ";
						cout << "C term ="; cin >> dive [2]; cout << dive [2] << endl;
			            cout << "   \n ";
						cout << "D term  ="; cin >> dive [3]; cout << dive [3] << endl;
						cout << " \n ";
						cout << "E term(constant) ="; cin >> dive [4]; cout << dive [4] << endl;
			cout << "your polynomial is \n";
			cout << " \n ";
			cout << "         " << dive [0] << "x^4 + " << dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3] << "x + " << dive [4] << endl;

			cout << "is this correct (0 for NO, anything else for YES)" << endl;// to make sure input is correct
			cin >> check_input1;
			cout << " \n \n \n \n \n \n \n " << endl;

			if (check_input1 == 0)
			{
				cout << "re-enter your A,B,C, D, and E terms, one by one. hitting enter after each one \n" << endl;
				cin >> dive [0];
				cin >> dive [1];
				cin >> dive [2];
				cin >> dive [3];
				cin >> dive [4];

				cout << "your  dividend polynomial is \n";
		cout << "         " << dive [0] << "x^4 + " << dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3] << "x + " << dive [4] << endl;
		cout << " \n \n \n \n \n \n \n " << endl;
			check_input1 = 2;/* makes it so whatever they enter in the second time gets automatically passed onto the divisor
							 input*/
			}
			if (check_input1 != 0)
			     {
					 cout << "you have stated that your divisor is a 3rd degree polynomial /n" << endl;
				cout << "               this will be in the form \n" << endl;
				cout << "   \n ";
				cout << "            Ax^3 + Bx^2 + Cx + D \n" << endl;
				cout << "\n";
				cout << "please enter your A term"; cin >> divi [0]; cout << divi [0] << endl;
				cout << "   \n ";
				cout << "please enter your B term"; cin >> divi [1]; cout << divi [1] << endl;
			    cout << "   \n ";
				cout << "please enter your C term"; cin >> divi [2]; cout << divi [2] << endl;
				cout << "   \n ";
				cout << "please enter your D term"; cin >> divi [3]; cout << divi [3] << endl;
				cout << "your divisor polynomial is \n";
			cout << divi [0] << "x^3 + " << divi [1] << "x^2 + " << divi [2] << "x + " << divi [3] << endl; 

			cout << "is this correct (0 for NO anything else for YES)" << endl;// to make sure input is correct
			cin >> check_input2;
			cout << " \n \n \n \n \n \n \n " << endl;


			if (check_input2 == 0)
			{
				cout << "re-enter your A, B, C, and D terms, one by one. hitting enter after each one \n" << endl;
				cin >> divi [0];
				cin >> divi [1];
			    cin >> divi [2];
				cin >> divi [3];

				cout << "your divisor polynomial is \n";
			cout << divi [0] << "x^3 + " << divi [1] << "x^2 + " << divi [2] << "x + " << divi [3] << endl;        
			

			cout << " \n \n \n \n \n \n \n " << endl;
			check_input2 = 2;
			}
			
			check_input2 = 2;


			}
			if (check_input2 != 0)
			{

				quo [0] = dive [0] / divi [0];
				line [0][0] = quo [0] * divi [0];
				line [0][1] = quo [0] * divi [1];
				line [0][2] = quo [0] * divi [2];
				line [0][3] = quo [0] * divi [3];
				line [0][4] = dive [4];
				line [1][0] = dive [0] - line [0][0];
				line [1][1] = dive [1] - line [0][1];
				line [1][2] = dive [2] - line [0][2];
				line [1][3] = dive [3] - line [0][3];
				line [1][4] = line [0][4];

				if ( line [1][0] != 0)
				{

cout << "         " << dive [0] << "x^4 + " << dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3] << "x + " << dive [4] << " /  " 
	 << divi [0] << "x^3 + " << divi [1] << "x^2 + " << divi [2] << "x + " << divi [3] << " \n \n " << endl;

cout << " = " << quo [0] << "x" << "     +     (" << line [1][0] << "x^4 + " << line [1][1] << "x^3 +" << line [1][2] << "x^2 +" << 
	line [1][3] << "x + " << line [1][4] << ") / " << divi [0] << "x^3 + " << divi [1] << "x^2 + " << divi [2] << "x + " << divi [3] << " \n \n " << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();


				}

				if (line [1][0] == 0)
				{
					
					if (line [1][1] == 0)/* if both line10 and line11 are zero then the divisor is of too high a degree to divide into
									thus we put out the remainder here	 */
					{
cout << "         " << dive [0] << "x^4 + " << dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3] << "x + " << dive [4] << " /  " 
	 << divi [0] << "x^3 + " << divi [1] << "x^2 + " << divi [2] << "x + " << divi [3] << " \n \n " << endl;

cout << " = " << quo [0] << "x" << "     +     (" << line [1][2] << "x^2 + " << line [1][3] << "x +" << line [1][4] << 
	") / " << divi [0] << "x^3 + " << divi [1] << "x^2 + " << divi [2] << "x + " << divi [3] << " \n \n " << endl;

cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();

				    }// close for if two terms = zero"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
		
			if (line [1][1] != 0)
					{
						abso [0] = abs (line [1][1]);
						
						if (divi [0] <= abso [0])/*if the first term of the divisor can divide into the new dividend  */
	  {
quo [1] = (line [1][1] / divi [0]);
line [2][1] = (quo [1] * divi [0]);
line [2][2] = (quo [1] * divi [1]);
line [2][3] = (quo [1] * divi [2]);
line [2][4] = (quo [1] * divi [3]);
line [3][1] = line [1][1] - line [2][1];
line [3][2] = line [1][2] - line [2][2];
line [3][3] = line [1][3] - line [2][3];
line [3][4] = line [1][4] - line [2][4];
abso [0] = abs (line [1][1]);

         if (line [3][1] != 0)
		 {
			 cout << "         " << dive [0] << "x^4 + " << dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3] << "x + " << dive [4] << " /  " 
	 << divi [0] << "x^3 + " << divi [1] << "x^2 + " << divi [2] << "x + " << divi [3] << " \n \n " << endl;
			 cout << " = " << quo [0] << "x" << " + " << quo [1] << "     +     (" << line [3][1] << "x^3 + " << line [3][2] << "x^2 +" << line [3][3] << 
	"x + " << line [3][4] << ") / " << divi [0] << "x^3 + " << divi [1] << "x^2 + " << divi [2] << "x + " << divi [3] << " \n \n " << endl;
 
			 cout << " \n \n \n \n \n \n "  << endl;
			 system("PAUSE");
			 return main();

		 }
		 if (line [3][1] == 0)
		 {
			 if (line [3][2] != 0)
			 {
				 cout << "         " << dive [0] << "x^4 + " << dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3] << "x + " << dive [4] << " /  " 
	 << divi [0] << "x^3 + " << divi [1] << "x^2 + " << divi [2] << "x + " << divi [3] << " \n \n " << endl;
			 cout << " = " << quo [0] << "x" << " + " << quo [1] << "     +     (" << line [3][2] << "x^2 + " << line [3][3] << "x +" << line [3][4] << 
 ") / " << divi [0] << "x^3 + " << divi [1] << "x^2 + " << divi [2] << "x + " << divi [3] << " \n \n " << endl;
			 cout << " \n \n \n \n \n \n "  << endl;
			 system("PAUSE");
			 return main();

			 }

			 if (line [3][2] == 0)
			 {
				 if (line [3][3] != 0)
				 {

				 cout << "         " << dive [0] << "x^4 + " << dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3] << "x + " << dive [4] << " /  " 
	 << divi [0] << "x^3 + " << divi [1] << "x^2 + " << divi [2] << "x + " << divi [3] << " \n \n " << endl;
			 cout << " = " << quo [0] << "x" << " + " << quo [1] << "     +     (" << line [3][3] << "x +" << line [3][4] << 
 ") / " << divi [0] << "x^3 + " << divi [1] << "x^2 + " << divi [2] << "x + " << divi [3] << " \n \n " << endl;
			 cout << " \n \n \n \n \n \n "  << endl;
			 system("PAUSE");
			 return main();
			 }
				 

				 if (line [3][3] == 0)
				 {
					 if (line [3][4] != 0)
					 {
						 cout << "         " << dive [0] << "x^4 + " << dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3] << "x + " << dive [4] << " /  " 
	 << divi [0] << "x^3 + " << divi [1] << "x^2 + " << divi [2] << "x + " << divi [3] << " \n \n " << endl;
			 cout << " = " << quo [0] << "x" << " + " << quo [1] << "     +     (" << line [3][4] << ") / " <<
				 divi [0] << "x^3 + " << divi [1] << "x^2 + " << divi [2] << "x + " << divi [3] << " \n \n " << endl;
			cout << " \n \n \n \n \n \n "  << endl;
			 system("PAUSE");
			 return main();
					 }


					 if (line [3][4] == 0)
					 {
						 cout << "         " << dive [0] << "x^4 + " << dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3] << "x + " << dive [4] << " /  " 
	 << divi [0] << "x^3 + " << divi [1] << "x^2 + " << divi [2] << "x + " << divi [3] << " \n \n " << endl;
			 cout << " = " << quo [0] << "x" << " + " << quo [1] <<  endl;
			 cout << " \n \n \n \n \n \n "  << endl;
			 system("PAUSE");
			 return main();
				 }
			}//close for if line [3][3] = 0

		 }// close for if [3][1] = 0


	  }
  if (divi [0] > abso [0])/*on the off chance it(^) can't, auto displays the large remainder  */
  {
cout << dive [0] << "x^3 + " <<		dive [1] << "x^2 + " << dive [2] << "x + " << dive [3]
	  << " / "  << divi [0] << "x + " << divi [1]  << endl;

cout << " \n = " << quo [0] << "x^2" << "      +      "  << line [1][1] << "x^2" << " + " << dive [2] << "x + " << 
	dive [3] << " / "  << divi [0] << "x + " << divi [1]  << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
   }



					}

				
			}
			}
			}


			

			}// this is for a selceted 3 degree DIVISOR


		if (secondchoice == 2)
		{

			cout << "you said your dividend is a 4rd degree polynomial, this will be in the form \n" ;
				cout << " \n ";
				cout << "               Ax^4 + Bx^3 + Cx^2 + Dx + E  \n " ;
					cout << "E is your constant term  \n";
				cout << "   \n ";	
				cout << "please enter in the corresponding coeffecients as they logically \n " << endl;
					cout << "appear on screen. numbers must be whole intergers\n " << endl ;
					cout << " \n " << endl;

					cout << "please enter the proper coeffecients for the corresponding terms below \n";
					cout << " \n ";
					cout <<"                Ax^4 + Bx^3 + Cx^2 + Dx + E \n \n \n";
					cout << " \n ";
					cout << "A term ="; cin >> dive [0]; cout << dive [0] << endl;
						cout << "   \n ";
						cout << "B term ="; cin >> dive [1];  cout << dive [1] << endl;
						cout << "   \n ";
						cout << "C term ="; cin >> dive [2]; cout << dive [2] << endl;
			            cout << "   \n ";
						cout << "D term  ="; cin >> dive [3]; cout << dive [3] << endl;
						cout << " \n ";
						cout << "E term(constant) ="; cin >> dive [4]; cout << dive [4] << endl;
			cout << "your polynomial is \n";
			cout << " \n ";
			cout << "         " << dive [0] << "x^4 + " << dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3] << "x + " << dive [4] << endl;

			cout << "is this correct (0 for NO, anything else for YES)" << endl;// to make sure input is correct
			cin >> check_input1;
			cout << " \n \n \n \n \n \n \n " << endl;

			if (check_input1 == 0)
			{
				cout << "re-enter your A,B,C, D, and E terms, one by one. hitting enter after each one \n" << endl;
				cin >> dive [0];
				cin >> dive [1];
				cin >> dive [2];
				cin >> dive [3];
				cin >> dive [4];

				cout << "your  dividend polynomial is \n";
		cout << "         " << dive [0] << "x^4 + " << dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3] << "x + " << dive [4] << endl;
		cout << " \n \n \n \n \n \n \n " << endl;
			check_input1 = 2;/* makes it so whatever they enter in the second time gets automatically passed onto the divisor
							 input*/
			}
			if (check_input1 != 0)
			{

			cout << "you have stated that your divisor is a 2rd degree polynomial /n" << endl;
				cout << "this will be in the form \n" << endl;
				cout << "Ax^2 + Bx + C \n" << endl;
				cout << "\n";
				cout << "please enter your A term"; cin >> divi [0]; cout << divi [0] << endl;
				cout << "please enter your b term"; cin >> divi [1]; cout << divi [1] << endl;
				cout << "please enter your c term"; cin >> divi [2]; cout << divi [2] << endl;

				cout << "your divisor polynomial is \n";
			cout << divi [0] << "x^2 + " << divi [1] << "x^ + " << divi [2] << endl;

			cout << "is this correct (0 for NO anything else for YES)" << endl;// to make sure input is correct
			cin >> check_input2;
			cout << " \n \n \n \n \n \n \n " << endl;

			if (check_input2 == 0)
			{
				cout << "re-enter your A,B, and C term, one by one. hitting enter after each one \n" << endl;
				cin >> divi [0];
				cin >> divi [1];
				cin >> divi [2];

				cout << "your divisor polynomial is \n";
			cout << divi [0] << "x^2 + " << divi [1] << "x^ + " << divi [2] << endl;
			cout << " \n \n \n \n \n \n \n " << endl;
			check_input2 = 2;
			}

			
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
			if (check_input2 != 0)
			{
				quo [0] = dive [0] / divi [0];
				line [0][0] = quo [0] * divi [0];
				line [0][1] = quo [0] * divi [1];
				line [0][2] = quo [0] * divi [2];
				line [0][3] = dive [3];
				line [1][0] = dive [0] - line [0][0];
				line [1][1] = dive [1] - line [0][1];
				line [1][2] = dive [2] - line [0][2];
				line [1][3] = line [0][3];
				line [1][4] = dive [4];
			 
				if (line [1][0] != 0)
				{

cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x^2 + " << dive [1] << "x + " << dive [2] << endl;

cout << " \n = " << quo [0] << "x^2" << "      +      ("  << line [1][0] << "x^4" << " + " << line [1][1] << "x^3 + " << 
line [1][2] << "x^2 +  " << line [1][3] << "x + " << line [1][4] << ") / "  << divi [0] << "x^2 + " << divi [1] << "x + " << divi [2] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
				}

				if (line [1][0] == 0)
				{
					if (line [1][1] == 0)

					{
						if (dive [0] > abs(line [1][2]))
						{
						cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x^2 + " << dive [1] << "x + " << dive [2] << endl;

cout << " \n = " << quo [0] << "x^2" << "      +      ("  << line [1][2] << "x^2 +  " << line [1][3] << "x + " << line [1][4] << 
") / " << divi [0] << "x^2 + " << divi [1] << "x + " << divi [2] << endl;

cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();


						}
						if (dive [0] <= abs(line [1][2]))
						{
							quo [1] = line [1][2] / divi [0];
							line [2][2] = quo [1] * divi [0];
							line [2][3] = quo [1] * divi [1];
							line[2][4] = quo [1] * divi [2];
							line [3][2] = line [1][2] - line [2][2];
							line [3][3] = line [1][3] - line [2][2];
							line [3][4] = line [1][4] - line [2][4];

							cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x^2 + " << dive [1] << "x + " << dive [2] << endl;

cout << " \n = " << quo [0] << "x^2 + " << quo [1] <<  "      +      ("  << line [3][2] << "x^2" << " + " << line [3][3] << "x + " << 
line [3][4] <<  ") / " << divi [0] << "x^2 + " << divi [1] << "x + " << divi [2] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();


						}

					}
					if (line [1][1] != 0)
					{

						if (divi [0] > abs(line [1][1]))
						{
							cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x^2 + " << dive [1] << "x + " << dive [2] << endl;

cout << " \n = " << quo [0] << "x^2" << "      +      (" << line [1][1] << "x^3 + " << 
line [1][2] << "x^2 +  " << line [1][3] << "x + " << line [1][4] << ") / "  << divi [0] << "x^2 + " << divi [1] << "x + " << divi [2] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
						}

						if (divi [0] <= abs(line [1][1]))
						{
							quo [1] = line [1][1] / divi [0];
							line [2][1] = quo [1] * divi [0];
							line [2][2] = quo [1] * divi [1];
							line [2][3] = quo [1] * divi [2];
							line [2][4] = line [1][4];
							line [3][1] = line [1][1] - line [2][1];
							line [3][2] = line [1][2] - line [2][2];
							line [3][3] = line [1][3] - line [2][3];
							line [3][4] = line [2][4];

							if (line [3][1] != 0)
							{
								cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x^2 + " << dive [1] << "x + " << dive [2] << endl;

cout << " \n = " << quo [0] << "x^2 +" << quo [1] <<  "x      +      ("  << line [3][1] << "x^3 + " << 
line [3][2] << "x^2 +  " << line [3][3] << "x + " << line [1][4] << ") / " << divi [0] << "x^2 + " << divi [1] << "x + " << divi [2] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
							}

							if (line [3][1] == 0)
							     {
									 if (line [3][2] == 0)
									 {
										 							cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x^2 + " << dive [1] << "x + " << dive [2] << endl;

cout << " \n = " << quo [0] << "x^2 +" << quo [1] <<  "x " << "    +      ("   << line [3][3] << "x + " << line [3][4] << 
	") / "  << divi [0] << "x^2 + " << divi [1] << "x + " << divi [2] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();

									 }
									 if (line [3][2] != 0)
									 {
									 if (divi [0] > abs(line [3][2]))
									 {
										 								cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x^2 + " << dive [1] << "x + " << dive [2] << endl;

cout << " \n = " << quo [0] << "x^2 +" << quo [1] <<  "x      +      ("  << line [3][2] << "x^2 +  " << line [3][3] << "x + " << line [1][4] << 
	") / "  << divi [0] << "x^2 + " << divi [1] << "x + " << divi [2] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
									 
									 }


									 if (divi [0] <= abs(line [3][2]))
									 {
										 quo [2] = line [3][2] / divi [0];
										 line [4][2] = quo [2] * divi [0];
										 line [4][3] = quo [2] * divi [1];
										 line [4][4] = quo [2] * divi [2];
										 line [5][2] = line [3][2] - line [4][2];
										 line [5][3] = line [3][3] - line [4][3];
										 line [5][4] = line [3][4] - line [4][4];

										 if (line [5][2] != 0)
										 {
											
								cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x^2 + " << dive [1] << "x + " << dive [2] << endl;

cout << " \n = " << quo [0] << "x^2 +" << quo [1] <<  "x  +" << quo [2] << "     +      ("  << line [5][2] << "x^2 +  " << line [5][3] << "x + " << line [5][4] << 
	") / "  << divi [0] << "x^2 + " << divi [1] << "x + " << divi [2] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
				

										 }

										 if (line [5][2] == 0)
										 {
											 

									
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
		
 if (line [5][3] != 0)
											 {

							cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x^2 + " << dive [1] << "x + " << dive [2] << endl;

cout << " \n = " << quo [0] << "x^2 +" << quo [1] <<  "x  +" << quo [2] << "     +      ("  << line [5][3] << "x + " << line [5][4] << 
	") / "  << divi [0] << "x^2 + " << divi [1] << "x + " << divi [2] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
				
											 }
											 if (line [5][3] == 0 && line [5][4] != 0)
											 {
												 							cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x^2 + " << dive [1] << "x + " << dive [2] << endl;

cout << " \n = " << quo [0] << "x^2 +" << quo [1] <<  "x  +" << quo [2] << "     +      ("  << line [5][4] << 
	") / "  << divi [0] << "x^2 + " << divi [1] << "x + " << divi [2] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();

											 }

											 if (line [5][3] == 0 && line [5][4] == 0)
											 {
												 cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x^2 + " << dive [1] << "x + " << dive [2] << endl;

cout << " \n = " << quo [0] << "x^2 +" << quo [1] <<  "x  +" << quo [2] << 
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
											 }
											 }
											 }

										 }// close for if [5][2] = 0)
									 }
									 
							     

						}
					}
								
				}//end for if [1][0] == 0
			} // end for correct dividend info
			}// end for correct divisor info
		}// end for divisors of two
		// this is where you enter the code for a 1st degree devisor

	if (secondchoice == 1)
		{

			cout << "you said your dividend is a 4rd degree polynomial, this will be in the form \n" ;
				cout << " \n ";
				cout << "               Ax^4 + Bx^3 + Cx^2 + Dx + E  \n " ;
					cout << "E is your constant term  \n";
				cout << "   \n ";	
				cout << "please enter in the corresponding coeffecients as they logically \n " << endl;
					cout << "appear on screen. numbers must be whole intergers\n " << endl ;
					cout << " \n " << endl;

					cout << "please enter the proper coeffecients for the corresponding terms below \n";
					cout << " \n ";
					cout <<"                Ax^4 + Bx^3 + Cx^2 + Dx + E \n \n \n";
					cout << " \n ";
					cout << "A term ="; cin >> dive [0]; cout << dive [0] << endl;
						cout << "   \n ";
						cout << "B term ="; cin >> dive [1];  cout << dive [1] << endl;
						cout << "   \n ";
						cout << "C term ="; cin >> dive [2]; cout << dive [2] << endl;
			            cout << "   \n ";
						cout << "D term  ="; cin >> dive [3]; cout << dive [3] << endl;
						cout << " \n ";
						cout << "E term(constant) ="; cin >> dive [4]; cout << dive [4] << endl;
			cout << "your polynomial is \n";
			cout << " \n ";
			cout << "         " << dive [0] << "x^4 + " << dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3] << "x + " << dive [4] << endl;

			cout << "is this correct (0 for NO, anything else for YES)" << endl;// to make sure input is correct
			cin >> check_input1;
			cout << " \n \n \n \n \n \n \n " << endl;


			if (check_input1 == 0)
			{
				cout << "re-enter your A,B,C, D, and E terms, one by one. hitting enter after each one \n" << endl;
				cin >> dive [0];
				cin >> dive [1];
				cin >> dive [2];
				cin >> dive [3];
				cin >> dive [4];

				cout << "your  dividend polynomial is \n";
		cout << "         " << dive [0] << "x^4 + " << dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3] << "x + " << dive [4] << endl;
		cout << " \n \n \n \n \n \n \n " << endl;
			check_input1 = 2;/* makes it so whatever they enter in the second time gets automatically passed onto the divisor
							 input*/
			}
			if (check_input1 != 0)
			{

			cout << "you have stated that your divisor is a 1st degree polynomial /n" << endl;
				cout << "this will be in the form \n" << endl;
				cout << "Ax + B \n" << endl;
				cout << "\n";
				cout << "please enter your A term"; cin >> divi [0]; cout << divi [0] << endl;
				cout << "please enter your b term"; cin >> divi [1]; cout << divi [1] << endl;

				

			cout << "your divisor polynomial is \n";
			cout << divi [0] << "x + " << divi [1] << endl;

			cout << "is this correct (0 for NO anything else for YES) \n \n \n \n \n \n \n" << endl;// to make sure input is correct
			cin >> check_input2;
			
			if (check_input2 == 0)
			{
				cout << "re-enter your A, and B term, one by one. hitting enter after each one \n" << endl;
				cin >> divi [0];
				cin >> divi [1];
				

				cout << "your divisor polynomial is \n \n \n \n \n \n";
			cout << divi [0] << "x^2 + " << divi [1] << endl;
			
			

			}
			

			else 
			{
			quo [0] = dive [0] / divi [0];
			line [0][0] = quo [0] * divi [0];
			line [0][1] = quo [0] * divi [1];
			line [1][0] = dive [0] - line [0][0];
			line [1][1] = dive [1] - line [0][1];
			line [1][2] = dive [2];
			line [1][3] = dive [3];
			line [1][4] = dive [4];

			
			

			if (line [1][0] != 0)
			{
cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3" << "      +      ("  << line [1][0] << "x^4" << " + " << line [1][1] << "x^3 + " << 
line [1][2] << "x^2 +  " << line [1][3] << "x + " << line [1][4] << ") / "  << divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
			}
			if (line [1][0] == 0)
			{

				if (line [1][1] == 0)
				{

					if (divi [0] > abs(line [1][2]))
					{
						cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3" << "      +      ("   << line [1][2] << "x^2 +  " << line [1][3] << "x + " << line [1][4] << ") / " 
<< divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
					}
					if (divi [0] <= abs( line [1][2]))
					{
						quo [1] = line [1][2] / divi [0];
						line [2][2] = quo [1] * divi [0];
						line [2][3] = quo [1] * divi [1];
						line [2][4] = dive [4];
						line [3][2] = line [1][2] - line [2][2];
						line [3][3] = line [1][3] - line [2][3];
						line [3][4] = line [2][4];

						if (line [3][2] != 0)
						{
							cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x " <<  "      +      ("  << 
line [3][2] << "x^2 +  " << line [3][3] << "x + " << line [3][4] << ") / "  << divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
						}
						

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
if (line [3][2] == 0)
						{
							if (line [3][3] == 0)
							{
								if (line [3][4] != 0)
										{					cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x " <<
	"      +      ("  << line [3][4] << ") / "  << divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();

								          }
								if (line [3][4] == 0)
								{
																cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x " << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();


								}
							}
							


							if (divi [0] > abs(line [3][3]))
							{
								cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x " <<  "      +      (" << line [3][3] << "x + " << line [3][4] << ") / " 
<< divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
							}
							if (divi [0] <=  abs(line [3][3]))
							{
								quo [2] = line [3][3] / divi [0];
								line [4][3] = quo [2] * divi [0];
								line [4][4] = quo [2] * divi [1];
								line [5][3] = line [3][3] - line [4][3];
								line [5][4] = line [3][4] - line [4][4];

								if (line [5][3] != 0)
									{
cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x + " << quo [2] <<  "      +      ("  
<< line [5][3] << "x + " << line [5][4] << ") / "  << divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
								     }

								if (line [5][3] == 0)
								{
									if (line [5][4] != 0)
									{
										cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x + " << quo [2] <<  "      +      ("  
<< line [5][4] << ") / "  << divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
									}

									if (line [5][4] == 0)
									{
			cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x + " << quo [2] <<  
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();

									}
							}

						}// close for if line [3][2] == 0

					}//end for 10&11 = 0 and i0 can divide into 12

				}// close for if line [1][1] = 0)
				
				}

				if (line [1][1] != 0)
				{
				
					if (divi [0] > abs (line [1][1]))
					{
						
cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + "   "      +      ("  
<< line [1][1] << "x^3 + " << line [1][2] << "x^2 + " << line [1][3] << "x + " << line [1][4] <<  ") / "  << divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();

					}
					
					if (divi [0] <= abs(line [1][1]))
					{
					quo [1] = line [1][1] / divi [0];
					line [2][1] = quo [1] * divi [0];
					line [2][2] = quo [1] * divi [1];
					line [3][1] = line [1][1] - line [2][1];
					line [3][2] = line [1][2] - line [2][2];
					line [3][3] = line [1][3];
					line [3][4] = line [1][4];

					if (line [3][1] != 0)
					{
						cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x^2 "   "      +      ("  
<< line [3][1] << "x^3 + " << line [3][2] << "x^2 + " << line [3][3] << "x + " << line [3][4] <<  ") / "  << divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
					}

					if (line [3][1] == 0)
					{
						if (line [3][2] == 0)
						{
							if (divi [0] > abs (line [3][3]))
							{
cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x^2 "   "      +      ("  
<<  line [3][3] << "x + " << line [3][4] <<  ") / "  << divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
							}

							if (divi [0] <= abs ( line [3][3]))
							{
							quo [2] = line [3][3] / divi [0];
							line [4][3] = quo [2] * divi [0];
							line [4][4] = quo [2] * divi [1];
							line [5][3] = line [3][3] - line [4][3];
							line [5][4] = line [3][4] - line [4][4];


							if (line [5][3] != 0)
							{
												
								
								cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x^2 +" << quo [2] <<   "      +      ("  
<<  line [5][3] << "x + " << line [5][4] <<  ") / "  << divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();

							}//close for if line 53 != 0
		
							if (line [5][3] == 0 && line [5][4] != 0)
							{
												cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x^2 +" << quo [2] <<   "      +      ("  
<<  line [5][4] <<  ") / "  << divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();

							}
							if (line [5][3] ==0 && line [5][4] == 0)
							{
												cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x^2 +" << quo [2] << 
cout << " \n \n \n \n \n \n " << endl;
system("PAUSE");
return main();
							}
							
							
							}
						}//close for if line [3][2] == 0


			
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
if (line [3][2] != 0)
						{

							if (divi [0] > abs (line [3][2]))
							{
	cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x^2 " << "     +      ("  
<< line [3][2] << "x^2 + " << line [3][3] << "x + " << line [5][4] <<  ") / "  << divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();

							}

							if (divi [0] <= abs (line [3][2]))
							{



								quo [2] = line [3][2] / divi [0];
								line [4][2] = quo [2] * divi [0];
								line [4][3] = quo [2] * divi [1];
								line [4][4] = line [3][4];
								line [5][2] = line [3][2] - line [4][2];
								line [5][3] = line [3][3] - line [4][3];
								line [5][4] = line [4][4];

								if (line [5][2] != 0)
								{
cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x^2 +" << quo [2] <<   "x      +      ("  
<< line [5][2] << "x^2 + " << line [5][3] << "x + " << line [5][4] <<  ") / "  << divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
								}
								if (line [5][2] == 0)
								{
									
									if ( line [5][3] == 0 && line [5][4] != 0)
									{

cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x^2 +" << quo [2] <<   "x      +      ("  
  << line [5][4] <<  ") / "  << divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
									}

									if (line [5][3] == 0 && line [5][4] == 0)
									{
cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x^2 +" << quo [2] <<   "x"  << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();

									}

									if (divi [0] > abs( line [5][3]))
									{
cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x^2 +" << quo [2] <<   "x      +      ("  
 << line [5][3] << "x + " << line [5][4] <<  ") / "  << divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();

									}

									if (divi [0] <= abs( line [5][3]))
									{
										quo [3] = line [5][3] / divi [0];
										line [6][3] = quo [3] * divi [0];
										line [6][4] = quo [3] * divi [1];
										line [7][3] = line [5][3] - line [6][3];
										line [7][4] = line [5][4] - line [6][4];

										if (line [7][3] != 0)
										{
															cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x^2 +" << quo [2] <<   "x + " << quo [3] << "      +      ("  
 << line [7][3] << "x + " << line [7][4] <<  ") / "  << divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
										}// close for if 73 != 0

										if (line [7][3] == 0)
										{
											if (line [7][4] != 0)
											{
																									cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x^2 +" << quo [2] <<   "x + " << quo [3] << "      +      ("  
 << line [7][4] <<  ") / "  << divi [0]  << "x + " << divi [1] << endl;
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();

											}// for if 74 != 0

											if (line [7][4] == 0)
											{
																									cout << dive [0] << "x^4 + " <<		dive [1] << "x^3 + " << dive [2] << "x^2 + " << dive [3]
<< "x  +"  << dive [4] << " /  " << divi [0]  << "x + " << divi [1] << endl;

cout << " \n = " << quo [0] << "x^3 + " << quo [1] << "x^2 +" << quo [2] <<   "x + " << quo [3] << 
cout << " \n \n \n \n \n \n "  << endl;
system("PAUSE");
return main();
											}
										}
									
										}//close for if [7][3] == 0
									}//close for is divi can go into line 53
								}//close for if line 52 == 0)


								}// close for in line 52 != 0

							}// close for if line [3][2] can be divided by our divi 0


						}// close for if line [3][2] != 0

					}//close for if line 31 ==0 after line 11 didnt == 0)
					}
				}// close for if line [1][1] != 0)
				

			} // close for line[1][0] = 0
			}// close for divisor = 1st degree

	}// close for dividend = 4th degree

	}//close for the division of plynmls function of this calculator

	if (mainfunction == 3)
{

	cout << " please choose what you would like to do with circle function \n \n \n " << endl;
	cout << " 1.) find the area of a circle \n \n " << endl;
	cout << " 2.) find the circumferance of a circle \n \n " << endl;
	cout << " 3.) find the speed while traversing around a circular arc \n \n \n \n \n \n " << endl;
	cin >> circlefunction;

	if (circlefunction > 3 || circlefunction < 1)
	{
		cout << "please choose between either 1, 2 or 3." << endl;
		cout << " 1.) find the area of a circle \n \n " << endl;
	cout << " 2.) find the circumferance of a circle \n \n " << endl;
	cout << " 3.) find the speed while traversing around a circular arc \n \n \n \n \n \n " << endl;
	cin >> circlefunction;
	}
	
	if (circlefunction == 1)
	{
		cout << "    you have chosen to find the area of a circle \n \n " << endl;
		cout << " please enter the radius or your circle in inches \n ";  cin >> radius;
		
		cout << " the area of your circle is " << (PI * (radius * radius)) << " inches^2 " << endl;
		cout << " \n \n \n \n \n \n \n \n \n \n " << endl;
		system("PAUSE");
		return main();

	}

	if (circlefunction == 2)
	{
		cout << "you have chosen to find the circumerance of a circle \n \n \n  " << endl;
		cout << " please enter the radius of your circle in inches \n " << endl;
		cin >> radius;
		cout << " the circumferance of your circle is " << (2 * PI * radius) << "inches" << endl;
		cout << " \n \n \n \n \n \n \n \n \n \n " << endl;
		system("PAUSE");
		return main();

	}

	if (circlefunction == 3)
	{
	cout << "you have selected to find the speed of an object traversing a circular arc \n \n \n \n " << endl;
	cout << " please enter the radius of you circle \n \n \n " ; cin >> radius;
	cout << " how many times did this object traverse the circle \n \n \n " << endl;
	cin >> timesaround;
	cout << " how long time it take to traverse this distance? \n \n \n  " << endl;
	cin >> time;
	totaldistance = (2 * PI * radius) * timesaround;
	speed = totaldistance / time;

	cout << " the speed was " << speed << "feet per second " << endl;
	 cout << " \n \n \n \n \n \n \n \n \n \n " << endl;
		system("PAUSE");
		return main();


	}


}



		_getch();

}
Topic archived. No new replies allowed.