Sa se calculeze si sa se afiseze valoarea distantei intre doua puncte, dandu-se coordonatele acestora: A(x1, y1) si B(x2, y2).
#include <iostream>
#include<cmath>
using namespace std;
int main()
{
int x1,y1,x2,y2;
float d;
cout<<“dati x1= “;cin>>x1;
cout<<“dati y1= “;cin>>y1;
cout<<“dati x2= “;cin>>x2;
cout<<“dati y2= “;cin>>y2;
d=sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) );
cout<<“Distanta intre “<<x1<<“,”<<y1<<” si “<<x2<<“,”<<y2<<” este = “<<d;
return 0;
}