1, who can tell me the defference between "cerr" and "cout"?
2, if I will handle these operations, how can I do?

cout << 7/2 << " " << 7/0<<" " << 7/3;

7/0 is wrong,but I will let the codes continue, that is , let the result of 7/3 output.
3, who can tell me the defference between exit(0) and exit(1), and what about abort()?
(I can't quite understand what the explaination on MSDN)

>>1, who can tell me the defference between "cerr" and "cout"?
cerr is effectively unbuffered, where the stream is flushed after every output operation. cout is not required to do this.

>>7/0 is wrong,but I will let the codes continue, that is , let the result of 7/3 output.
That's a quality of implementation issue. I get a compile-time error for that code. The following code compiles for me because the divide-by-zero error doesn't involve just compile-time constants, but it crashes when trying to divide by zero:

#include <iostream>

int main()
{
  int x = 0;

  std::cout << 7/2 << " " << 7/x << " " << 7/3;
}

>>3, who can tell me the defference between exit(0) and exit(1), and what about abort()?
The value you pass to exit() will be used basically the same as if you returned that value from main:

exit(0) == return 0 // from main
exit(1) == return 1 // from main

The difference between exit(0) and exit(1) is that exit(0) is portable while exit(1) is not. Any value except for 0 and the macros EXIT_SUCCESS/EXIT_FAILURE defined in <cstdlib> has an implementation-defined meaning. Any value except for 0 and EXIT_SUCCESS means failure, but exactly what kind of failure depends on the system you're using.

>>I can't quite understand what the explaination on MSDN
I've come to the conclusion that MSDN tries to be cryptic. ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.