Because << has higher precedence than = so line 6 is treated as (cout << c) = 0;.
Put parenthesis around the assignment fixes the error. cout << (c = 0);
unfortunately not so much maffiq.I know how to produce good output but I am trying to solve the question.
Answer of Peter87 was more to the point.That was what I noticed myself.But (cout << c) return s an ostream object, isn't it?Why am not able to assign to it value 0?