User talk:Zhangfan.shawn

C++ Operator overload
How to use the overload operator "<<"?

For example, "<<" is overload as:

std::ostream& operator<<(std::ostream& os, const WorkMsg& wm) { os <<"[" << wm.result << "]"; return os; }

TO USE IT: Assume we have a object: WorkMsg msg;

read the string from the Manager feedback: std::ostringstream message;Create a ostringstream (#include ) message<>number; for(int a=1;a<=number;a++){ if(number%a==0) count++;}

if(count==2) cout<<" PRIME NUMBER \n"; else cout<<" NOT A PRIME NUMBER \n";