שלום
התרגיל הנתון הוא יצירת תוכנה שתמדוד מרחק של שלוש צלעות המשולש ותראה את היקפו. את ההיקף ניתן למצוא לפי נוסחאת מרחק וע"י פקודת sqrt .למישהו יש רעיון איך מתקנים את מה שעשיתי? לא כל כך מבין איך מפעילים את עקרון הsqrt ...
תודה רבה מראש !! אני מצרף את מה שעשיתי עד עכשיו...
#include <iostream.h>
#include <math.h>
void main()
{
int Point1,Point2,Point3,Point4,Point5,Point6,dist,dist2,dist3,Distance;
float sqrt;
dist=(Point3-Point1)^2&(Point4-Point2)^2;
dist2=(Point5-Point3)^2&(Point6-Point4)^2;
dist3=(Point5-Point1)^2&(Point6-Point2)^2;
Distance=dist+dist2+dist3;
cout<<" Please enter the 1st point numbers: ";
cin>>Point3>>Point1;
cout<<"Please enter the 2nd point numbers: ";
cin>>Point4>>Point2;
cout<<" Please enter the 3rd point numbers: ";
cin>>Point5>>Point6;
cout<<"Please wait while calculating...\n";
cout<<"The Distance between the two is: ";
cout<<Distance;
}