How do I output this using functions for C If its right ill
How do I output this using functions for C++? If its right ill rate right away! Thanks!
Solution
#include<iostream.>
#include<string.h>
#include<math.h>
void functionDistance(){
float distance;
int x1,x2,y1,y2;
cout<<\"Please enter x1:\"<<endl;
cin>>x1;
cout<<\"Please enter y1:\"<<endl;
cin>>y1;
cout<<\"Please enter x2:\"<<endl;
cin>>x2;
cout<<\"Please enter y2:\"<<endl;
cin>>y2;
distance = sqrt(power((x_2 -x_1),2)+ power((y_2- y_1),2));
cout<<\"The distance is\"<<distance;
}
void main()
{char c;
cout<<\"Please enter y if want to enter infomation\";
get(c);
if(c)
{
functionDistance();
}
}
