Computer Science Canada overload |
Author: | alpesh [ Thu May 05, 2005 6:47 am ] | ||
Post subject: | overload | ||
|
Author: | alpesh [ Thu May 05, 2005 6:50 am ] | ||
Post subject: | friend() overload | ||
|
Author: | Andy [ Thu May 05, 2005 7:54 am ] |
Post subject: | |
1, this should be in tutorial/sourcecodes, 2, im sure someone already did a tutorial on this 3, please add in some comments so the newbies can understand it thank you for contributing |
Author: | jamonathin [ Thu May 05, 2005 8:05 am ] |
Post subject: | |
Andy wrote: 3, please add in some comments so the newbies can understand it
thank you for contributing <------------- Prime Example |
Author: | wtd [ Thu May 05, 2005 12:05 pm ] | ||||||||||
Post subject: | |||||||||||
Wow. That's some bad code. First off, you include "iostream.h", which is deprecated. Instead use:
Second, "time.h" should in C++ be "ctime".
Third, you use "conio.h", limiting this program to Windows. Eliminate this entirely. Clearing the screen is pointless for a terminal-based app. Fourth, in C++ there's no need to use the "struct" when declaring a variable. All structs are in the namespace properly.
Becomes:
Since we use "iostream" rather than "iostream, we have to explicitly tell the compiler cout is in the std namespace.
Lastly (for now), main should be declared as returning int (an int indicates the success or failure of the program to the OS). At the end of it, you should explicitly return zero. |