I'm having some trouble with a simple little program i made. I was in Geometry and we had just got some formulas, and i could do them all in my head but everyone else was having trouble with them. So i knew there was a better way and then i came home and made this program. It is used to find the midpoint between two points on a coordinate gride or w/e its called =p.

Code:

#include <iostream>
using namespace std;
int main()
{
int R, T, Y, U, A, B;
cout<<"Hello. Please enter X1:";
cin>> R;
cout<< "Now X2:";
cin>> T;
cout<< "Now Y1:";
cin>> Y;
cout<< "Finally Y2:";
cin>> U;
cin.ignore();
A = R + T;
B = Y + U;
A = A / 2;
B = B / 2;
cout<<"The midpoint of the two points is [";
cout<< A <<",";
cout<< B;
cout<< "]";
cin.get ();
}

The problem is that the program doesnt put out decimals so it's essentially useless.

I also created this program which is used to find the distance between two points.

Code:

#include <iostream>
using namespace std;
int main()
{
int R, T, Y, U, A, B, C, D, E, M;
cout<< "Hello Please enter X1:";
cin>> R ;
cout<< "Now X2:";
cin>> T;
cout<< "Y1:";
cin>> Y;
cout<< "Now finally Y2:";
cin>> U;
cin.ignore ();
A = R - T;
B = Y - U;
C = A * A;
D = B * B;
E = C + D;
cout<< "Square this number to get the distance :" << E <<"\n";
cout<< "Would you like to find the distance of another number (1 y, 2 n)";
cin>> M;
if ( M == 1 ) {
cout<< "Hello Please enter X1:" ;
cin>> R ;
cout<< "Now X2:";
cin>> T;
cout<< "Y1:";
cin>> Y;
cout<< "Now finally Y2:";
cin>> U;
cin.ignore ();
A = R - T;
B = Y - U;
C = A * A;
D = B * B;
E = C + D;
cout<< "Square this number to get the distance :" << E <<"\n";
cout<< "Thanks for using the program!"<<"\n";
cin.get ();
}
else if ( M == 2 ){
}
cin.ignore();
}

My knowledge of C++ is very limited, i only got about 5 or 6 lessons in on the tutorials and then school started taking over my life. Any help with my problem is greatly appreciated ^_^ (ALso i realize that this is probably very sloppy coding so i'm sorry in advance)