So I typed out this code, but uncertain why the user isn't prompted to enter the values... could anyone help please? I'm sure there's redundant info in here since i'm a noob...there's 3 files... main, xypoint.cpp, and xypoint.h
// main.cpp
#include <iostream>
using namespace std;
#include "xypoint.h"
int main(void)
{
xypoint a1(-5, 7);
xypoint b1(10, 3);
int z=a1.distance(b1);
cout << z << endl;
return 0;
}
// xypoint.h
#ifndef xypoint_H
#define xypoint_H
#include <iostream>
using namespace std;
class xypoint
{
public:
xypoint(float X, float Y);
float a;
float b;
float distance(xypoint point) const;
friend ostream& operator<<(ostream& stream, xypoint& point );
friend istream& operator>>( istream&, xypoint& point );
1.) Constructors don't return values (at least I've never seen anyone return from a constructor...)
2.) Only the operator >> will prompt for input. You are never using cin >> myxypoint; or anything similar, you are only using the constructors to create the points.