![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#31 | |
|
Professional Programmer
|
This is one of the areas that im trying to correct the problem in.
do{ // This is the strength loop, if you enter a number larger than 20 or less than 1, you will be taken back to this step.
Points = 20;
cout << "Enter your strength: ";
cin >> Str;
if ( Str < 1 ) { // If the input is less than 1, the string below is executed and you will be asked to input a new integer.
cout << "You Must spend at least one point!\n\n";
}
if ( Str > Points - 2 ){ // If the input is greater than the existing points, the string below will be executed and you will be asked to input a new integer.
cout << "You don't have enough points!\n\n";
}
} while ( Str > Points - 2 || Str <= 0 );
cout << "Strength leveled up to " << Str << "!" << endl; // Lets you know that your selected integer was successfully added.
Points = Points - Str; // Adds the selected points on to strength and reduces that same amount from your remaining skill points.
cout << "You have " << Points << " skill points remaining.\n\n";
__________________
▄▄▄▄ Quote:
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it. Download Code::Blocks now! ▄▄▄▄ |
|
|
|
|
|
|
#32 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
cout << "Enter your strength: "; cin >> Str;
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
#33 | |||
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Quote:
Quote:
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|||
|
|
|
|
|
#34 | |
|
Professional Programmer
|
Ah hah! I finally figured out how i was gona go about fixing this little problem, thanks to dawei's help. Thanks
__________________
▄▄▄▄ Quote:
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it. Download Code::Blocks now! ▄▄▄▄ |
|
|
|
|
|
|
#35 | |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Quote:
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
|
#36 | |
|
Professional Programmer
|
forget it.. Worked for the strength and intel, but agility would just add 8 skill points whenever a letter or invalid character was entered.
__________________
▄▄▄▄ Quote:
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it. Download Code::Blocks now! ▄▄▄▄ |
|
|
|
|
|
|
#37 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
The problem, Jayme, and this isn't criticism, just fact, is that you have some concept in your mind of what you're trying to do. Further, you're sitting in front of your system with a visibility of everything you've done. All we get is snippets and whatever you think to post about them. It's a handicap. The only way you can get "full service" is to present as much as you possibly can, as clearly as you possibly can.
If you think you need to show a pot-load of code, feel free to zip it up and attach it to a post. There is no magic here. There is only thought and sweat and experience (of whatever level). I realize that there was a lot of digression and misdirection. Sometimes that happens. You can either say, "Oh eff it," and write it off, or you can continue to ask for help, providing what information you can, to the best of your ability.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#38 | |
|
Professional Programmer
|
well, i've been looking at the different possible ways shown here how i could have gone about avoiding the problem im having, only to come to my senses.. My code is ugly. I have decided to re-write the whole thing, since im not too far along so it should only take about 10 mins lol. Knowing what i know now, I will most likely be able to "overcome" this obsticle.
__________________
▄▄▄▄ Quote:
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it. Download Code::Blocks now! ▄▄▄▄ |
|
|
|
|
|
|
#39 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
You'll be having the same problems years from now, just a different level. You'll always look back on your old code with something approaching disgust. Name of the game. Post for help when you're ready, or need it.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|