c++ Cartesian class not asking for user input -


my program supposed ask user input 2 sets of coordinates @ runtime. however, when compile , run it not ask input , instead gives me output

please enter first coordinates in form x y:  please enter second coordinates in form x y: (0, 0) (0, 0) 

how can fix this?

#include <iostream> #include <istream> #include <ostream>  using namespace std;  class cartesian { private:     double x;     double y; public:     cartesian(double = 0, double = 0);     friend istream& operator>>(istream&, cartesian&);     friend ostream& operator<<(ostream&, const cartesian&); };  cartesian::cartesian(double a, double b) {     x = a;     y = b; }  istream& operator>>(istream& in, cartesian& num) {     in >> num.x; in >> num.y;      return in; }  ostream& operator<<(ostream & out, const cartesian& num) {     cout << "(" << num.x << ", " << num.y << ")" << endl;      return out; }  int main() {     cartesian coord1, coord2;     cout << "please enter first coordinates in form x y: ";     cin >> coord1;     cout << "please enter second coordinates in form x y: ";     cin >> coord2;     cout << coord1;     cout << coord2;      return 0; } 

on windows need specially configure project in order recieve input console

http://www.cplusplus.com/doc/tutorial/introduction/visualstudio/


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -