 00:00
00:00
View Profile
"I put on my robe and wizard hat.."

29, Male

Student

NaN

Leeds

Joined on 12/11/04

Level:
22
Exp Points:
4,950 / 5,380
Exp Rank:
6,367
Vote Power:
Rank:
Police Officer
Global Rank:
11,488
Blams:
556
Saves:
251
B/P Bonus:
10%
Whistle:
Bronze
Medals:
222
Gear:
2 Best C++ program EVER

Posted by liam - October 3rd, 2008

I just need to add the actual line. wintard.

#include <iostream>
#include <math.h>

using namespace std;

double distance(double pa, double pb){
double result = sqrt((pow(pb-pa, 2)+pow(pb-pa, 2)));
return result;
}

double gradient(double pa, double pb){
double result = (pa-pb)/(pa-pb);
return result;
}

double midpoint(double pa, double pb){
double result = (pa+pb)/2;
return result;
}

int main(){
double pointa, pointb;
cout << "Graphical Math calculator"<< endl<<"Enter 2 co-ordinates: "<<endl<<" 1st:\nX:";
cin>>pointa; cin.ignore(0); cout<<"Y:"; cin>>pointa; cout<<"\n 2nd:\nX:";
cin>>pointb; cout<<"Y:"; cin>>pointb; cout<<"\n";
for(int a=1; a<21; a++){
for(int b=1; b<21; b++){
if((pointa==21-a && pointa==b)){
cout<<"AA";
} else if((pointb==21-a && pointb==b)){
cout<<"BB";
} else {
cout<<"--";
}
}
if(a==2){
cout<<" AA: ("<<pointa<<","<<pointa<<")"<<en dl;
} else if(a==3){
cout<<" BB: ("<<pointb<<","<<pointb<<")"<<en dl;
} else if(a==9){
cout<<" Distance: "<<distance(pointa, pointb)<<endl;
} else if(a==10){
} else if(a==11){
cout<<" Midpoint: ("<<midpoint(pointa, pointb)<<", "<<midpoint(pointa, pointb)<<")"<<endl;
} else {
cout<<endl;
}
}
return 0;
}