struct, function and pointer problem
Hi, i am learning c++ by myself . I am trying to write a code to find slop using struct, function and pointer.
In the main function i really get lost.
Any help will be appreciate.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include <iostream>
using namespace std;
struct king
{
double x1,x2;
double y1,y2;
};
double distance (king*ptr)
{
return (ptr->y2 - ptr->y1) / (ptr->x2 - ptr->x1);
}
int main()
{
cout <<"Enter x2 ";
cin >>x2;
cout <<"Enter x1";
cin >>x1;
cout <<"Enter y2 ";
cin >>y2;
cout >>"Enter y1";
cin >>y1;
}
|
Last edited on
Topic archived. No new replies allowed.