Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. istream &operator >>(istream &cin, Kompleksni &a) {
  2.  char znak;
  3.  cin >> ws; // "Progutaj" razmake
  4.  if(cin.peek() != '(') {
  5.  cin >> a.re;
  6.  a.im = 0;
  7.  }
  8.  else {
  9.  cin >> znak >> a.re >> znak;
  10.  if(znak != ',') cin.setstate(ios::failbit);
  11.  cin >> a.im >> znak;
  12.  if(znak != ')') cin.setstate(ios::failbit);
  13.  }
  14.  return cin;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement