On Suday the 11th of February, 2007 -after 3 and a half years on InvisionFree, we have moved! This old board remains as a read only archive of years past, and registration has been disabled here. All new and current members should register at http://www.cpplc.net/forum .
| · Portal |
Help
Search
Members
Calendar
|
| Welcome Guest ( Log In | Register ) | Resend Validation Email |
| Welcome to C++ Learning Community. We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
![]() ![]() ![]() |
| Shonoby |
Posted: Feb 9 2007, 02:15 AM
|
||||||
![]() ...Philosopher... Group: Members Posts: 132 Member No.: 2,295 Joined: 23-November 06 |
Well, i have been playing around with my programming skills trying to develop my skill and making efficient algos. and stuff. I need to know just how effiecient this is not including how i created the dynamic memory ( i.e... i just began to learn them ). When i say efficent i mean thing like: Hiding info from client Readability ( no comments... ) and so on, u know things of that nature or more specify if it accomplishes the programmers goals in making codes. You should know them i guess. Well here they are codes: Header File:
Class Definition:
Using The Class ( i.e Main ):
So how is it?? -------------------- Foolish Brother.
If You Wish To Kill Me, Hate Me, Detest Me... And Survive In An Unsightly Way. Run And Cling On To Life. I HEART TEMPLATES My Philosophies: If you want to be great in life, defy it. The best answers we find on our own. It's not how a guitar looks, it's how you make it look. A life of love; is eventually a life of hate.(Via Versa) Don't hate the ( skate || key )board, hate yourself. It's not a question of if death happens because: All death is certain, but when it happens is the question. |
||||||
| adeyblue |
Posted: Feb 9 2007, 03:52 AM
|
||||
|
The Colin Mochrie of the Windows World Group: Members Posts: 28 Member No.: 2,013 Joined: 30-August 06 |
Ahh, reminds me of a Java assignment I've just done for uni. Anyhoo couple of things: Interest is a bad name for this class since it also deals with names and balances. Account would be better. You don't have to include <new> here as you're not using placement new or std::nothrow. You're inconsistent with the set function return types. They should all be void here but you've got some returning *this for some reason. This may be just me but I'd expect setter functions to do just that, and nothing else. For example, I wouldn't expect a function called setBalance to possibly change the interest as well. Same with the get functions, I'd expect them to return variables but you've got two of them as void. These should probably be renamed print* or display* or similar. Include <string> and use std::string instead of char*. Then you don't have to bother with new, delete, strlen, and strcpy when dealing with the names, as they do it internally.
This doesn't do what you think it does, year is only checked against 1; not 1, 2, and 3. Here, if year doesn't equal 1, 2 is evaluated. Since 2 is never false (it's not 0) the if part will always happen and the else has as much chance as happening as the Rockies winning the World Series. You need to do
to get desired behaviour.
And the nitpicky stuff Doesn't the dollar sign come before the amount of money, not after? (assuming you're from North America) oh and it's spelled interest So yeah, it looks a lot but it's only a few things. -------------------- I don't write messy code, you're just not reading it properly
AudioPlayer - FileSplitter - Windows ACL and ACE Utilities |
||||
| Shonoby |
Posted: Feb 9 2007, 04:28 AM
|
||||
![]() ...Philosopher... Group: Members Posts: 132 Member No.: 2,295 Joined: 23-November 06 |
Well, u have written exactly what i would expect some1 to write. For several reason, one i really made this code joking to see if any1 could see through many of its irregularities. Also i was purposely miss naming and miss treating my data and member function to see how some1 ( i.e u for now ) would react or even study this code. This code was made for another reason so i could study the the way a experience or not experience programmer would decipher this code. Because i study the human mind, so i was really manipulating the code on purpose so that i could further increase my data on the mind. I know it sounds weird but i am a person who deciphers many thing so i am what u call a philosopher. But i know what u mean about the weird data names and member functions. Also my skills at programming are really not all that great; the reason i decided to use these weird methods of creating this code was to test my skill also. This code like i said before was a joking code ( made it like so on purpose ), but also about the std::string is that i have not learned every operation, keyword in C++ i use the one available to my skill. Since i am still learning my skill is still growing but i am only aware of so much, but currently i needed to improve my skill in:
Usually when i do that i use and operation:
it now checks to see all the values. What u said about now having to include <new>, well u have to include new so that the compiler know what new is. On my previous codes i have not used <new> header file and even though no error came up, the char name would not display. Also the interest thing LOL woops, well i am not the best speller in the world... -------------------- Foolish Brother.
If You Wish To Kill Me, Hate Me, Detest Me... And Survive In An Unsightly Way. Run And Cling On To Life. I HEART TEMPLATES My Philosophies: If you want to be great in life, defy it. The best answers we find on our own. It's not how a guitar looks, it's how you make it look. A life of love; is eventually a life of hate.(Via Versa) Don't hate the ( skate || key )board, hate yourself. It's not a question of if death happens because: All death is certain, but when it happens is the question. |
||||
![]() |
![]() ![]() ![]() |