It is currently Tue Aug 05, 2025 9:38 pm

All times are UTC - 5 hours



Forum rules


1.) No trolling. If you cant have fun without being a jerk to others, find some other forum to QQ
2.) No inappropriate/vulgar/sexually explicit posting. Staff reserves the right to deem anything they see fit as inappropriate.
3.) Have fun and don't post anything not geared at having fun!
4.) Please respect staff members and their decisions at all times. If you cannot accept a staff or moderator decision, please appeal to admin Seth.



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Jakes new C++ problem
PostPosted: Wed Jan 11, 2012 3:34 pm 
Major
Major
User avatar
 Profile

Joined: Sat Dec 19, 2009 7:48 pm
Posts: 2693
Gender: male
Alright so I have been working on this code for 20 minutes now and I never seem to get the whole dieing part to work right in my combat system, it just seems like you can skip past it.

here is the code:

Spoiler:
#include <iostream>
#include <cmath>

using namespace std;
int main ()
{

cout << "What is your name?" << endl;
char name;
cin >> name;
cout << "I will call you " << name << endl;
cout << name << ": what is this all about?" << endl;
cout << "This is about whatever you want it to be about, you are the creator" << endl << name << ": what???" << endl;
system ("pause");
cout << "New mission Enter 1 to continue" << endl;
int answer;
cin >> answer;

if (answer == 1)
{
cout << "What is the password?" << endl;
cout << "Hint : what do I call you?" << endl;
char answera ;
cin >> answera;
if (answera == name)
{
cout << "Good..." << endl;
}
else
{
cout << "You are not the creator, my mistake." << endl;
system ("pause");
return 0;
}
cout << "When you, the creator created this program, you wanted it to be like a RPG, so you are level one, I will now display your stats." << endl;
int level;
int hp;
int mp;
int dam;
level =+ 1;
hp =+ 100;
mp =+ 100;
dam =+ 5;
cout << "HP: " << hp << endl;
cout << "MP: " << mp << endl;
cout << "Level: " << level << endl;
cout << " You are a newb to this world." << endl;
system ("pause") ;
cout << name << ": Great, so how do I start?" << endl;
cout << "Start by making a monster, what will its name be?" << endl;
char monstername;
cin >> monstername;
cout << "We only use one letter names, so his/her name will be:" << monstername << endl;
cout << "What will " << monstername << "'s stats be?" << endl;
cout << "follow this order, HP " << endl << "MP" << endl << "Damage" << endl;
int mhp;
int mmp;
int mdmg;
cin >> mhp;
cin >> mmp;
cin >> mdmg;
cout << "Okay so the monsters stats are:" << endl << mhp << endl << mmp << endl << mdmg << endl;
cout << "Now fight him." << endl;
cout << name << ": ...(Want to be allies? Sometimes I like to pretend I am a princess riding a pony..)" << endl;

cout << "Attack? (1=yes 2=no)" << endl;
char attack;
cin >> attack;
if (attack == 1)
{
while (attack == 1)
{
cout << "You attack!" << endl;
hp -= mdmg;
mhp -= dam;
cout << "Hp:" << endl << hp << endl << mhp << endl;
cout << "Attack?" << endl;
cin >> attack;
if (hp == 0)
{
answer =+ 5;
cout << "You died :(" << endl;
system ("pause");
return 0;
}

}
}

}
system ("pause");
return 0;
}


So any tips?

_________________
Image

Image


Top
 

 Post subject: Re: Jakes new C++ problem
PostPosted: Wed Jan 11, 2012 4:36 pm 
Sergeant
Sergeant
User avatar
 Profile

Joined: Tue Nov 30, 2010 10:37 pm
Posts: 113
lol... It seems to exit me out when it says press any key to continue-_-

darn C++:P well i shall look it over without playing i guess

edit*** ok well i see the problem... what would u like it to do when you die ill modify your code for you

_________________
Highest Rank: Rank 1
Curent # of achivments: 34
Most relics held at one time: All 10.
Favorite allience to have won with: MGH
~Lain, fear the RAWR!


Top
 

 Post subject: Re: Jakes new C++ problem
PostPosted: Wed Jan 11, 2012 7:02 pm 
Captain
Captain
User avatar
 Profile

Joined: Mon Oct 17, 2011 5:02 pm
Posts: 742
Location: Milwaukee, WI
Gender: male
If the amazing Jake can die that is...

_________________
SkittlesYUM
Image
Image


Top
 

 Post subject: Re: Jakes new C++ problem
PostPosted: Wed Jan 11, 2012 7:29 pm 
Major
Major
User avatar
 Profile

Joined: Sat Dec 19, 2009 7:48 pm
Posts: 2693
Gender: male
LainRAWR wrote:
lol... It seems to exit me out when it says press any key to continue-_-

darn C++:P well i shall look it over without playing i guess

edit*** ok well i see the problem... what would u like it to do when you die ill modify your code for you


Rofl, well I would like it to end program for now until I have a resurection system of sorts.

(This is just my short project, its not really supposed to be for anyone but myself.)

_________________
Image

Image


Top
 

 Post subject: Re: Jakes new C++ problem
PostPosted: Wed Jan 11, 2012 7:59 pm 
Sergeant
Sergeant
User avatar
 Profile

Joined: Tue Nov 30, 2010 10:37 pm
Posts: 113
Jake wrote:
LainRAWR wrote:
lol... It seems to exit me out when it says press any key to continue-_-

darn C++:P well i shall look it over without playing i guess

edit*** ok well i see the problem... what would u like it to do when you die ill modify your code for you


Rofl, well I would like it to end program for now until I have a resurection system of sorts.

(This is just my short project, its not really supposed to be for anyone but myself.)


ok, well i really can't test this since ur program keeps kicking me out-_-

just make int endgame =1; at the start of the program, then change your while loop to say while (attack == 1 && endgame == 1)

then change ur code to look like:

if (hp == 0)
{
answer =+ 5;
cout << "You died :(" << endl;
system ("pause");
endgame = 0;
return 0;
}

}
if (endgame == 0){
cout << "Game Over...";
system ("pause");
}

add the additional if statement, this should get you out of your while loop and give a game over message... tell me if this doesn't work (but it should).

_________________
Highest Rank: Rank 1
Curent # of achivments: 34
Most relics held at one time: All 10.
Favorite allience to have won with: MGH
~Lain, fear the RAWR!


Top
 

 Post subject: Re: Jakes new C++ problem
PostPosted: Wed Jan 11, 2012 8:05 pm 
Major
Major
User avatar
 Profile

Joined: Sat Dec 19, 2009 7:48 pm
Posts: 2693
Gender: male
LainRAWR wrote:
Jake wrote:
LainRAWR wrote:
lol... It seems to exit me out when it says press any key to continue-_-

darn C++:P well i shall look it over without playing i guess

edit*** ok well i see the problem... what would u like it to do when you die ill modify your code for you


Rofl, well I would like it to end program for now until I have a resurection system of sorts.

(This is just my short project, its not really supposed to be for anyone but myself.)


ok, well i really can't test this since ur program keeps kicking me out-_-

just make int endgame =1; at the start of the program, then change your while loop to say while (attack == 1 && endgame == 1)

then change ur code to look like:

if (hp == 0)
{
answer =+ 5;
cout << "You died :(" << endl;
system ("pause");
endgame = 0;
return 0;
}

}
if (endgame == 0){
cout << "Game Over...";
system ("pause");
}

add the additional if statement, this should get you out of your while loop and give a game over message... tell me if this doesn't work (but it should).


I will give it a shot :)

hmm, keeps kicking me out after it asks whether you want to attack or not...

_________________
Image

Image


Top
 

 Post subject: Re: Jakes new C++ problem
PostPosted: Wed Jan 11, 2012 8:10 pm 
Sergeant
Sergeant
User avatar
 Profile

Joined: Tue Nov 30, 2010 10:37 pm
Posts: 113
k:) and looks like ur just learning C++?

anyways if u need anymore help just msg me

_________________
Highest Rank: Rank 1
Curent # of achivments: 34
Most relics held at one time: All 10.
Favorite allience to have won with: MGH
~Lain, fear the RAWR!


Top
 

 Post subject: Re: Jakes new C++ problem
PostPosted: Wed Jan 11, 2012 8:11 pm 
Major
Major
User avatar
 Profile

Joined: Sat Dec 19, 2009 7:48 pm
Posts: 2693
Gender: male
LainRAWR wrote:
k:) and looks like ur just learning C++?

anyways if u need anymore help just msg me


skype :P I want to become a master!

(And I have been interested in C++ a long time, im just now getting back to it.)

_________________
Image

Image


Top
 

 Post subject: Re: Jakes new C++ problem
PostPosted: Wed Jan 11, 2012 8:12 pm 
Lieutenant Major
Lieutenant Major
 Profile

Joined: Mon Feb 14, 2011 3:24 pm
Posts: 2325
Location: no location for you
Gender: female
i got a question what is C++? (yes i have no idea)

_________________
Image
Image
PSN: aLpHaOmEgAXII


Top
 

 Post subject: Re: Jakes new C++ problem
PostPosted: Wed Jan 11, 2012 8:15 pm 
Sergeant
Sergeant
User avatar
 Profile

Joined: Tue Nov 30, 2010 10:37 pm
Posts: 113
sure pm me ur skype. Om fluent in it and other languages.

OmegaXII wrote:
i got a question what is C++? (yes i have no idea)


its a programing language:P

_________________
Highest Rank: Rank 1
Curent # of achivments: 34
Most relics held at one time: All 10.
Favorite allience to have won with: MGH
~Lain, fear the RAWR!


Top
 

Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group  
Copyright Tacticsoft Ltd. 2008   
Updated By phpBBservice.nl