Hello Everybody I'm stealth:
I just started learning C++ but I do have experience in programming (not C++ better not say what though) anyway
I started a text combat engine and I have problems already
so I thought I'd post the code and let u guys see and hopefully help me out,dunno what the problem is actually ( like I said I'm new) anyway so far I have it printing the stats of the players health but then I want it to print who starts the match according to who is the fastest of the players , sorry if this is confusing but
I'll post the code so that it's more clear what I have done
#include <iostream.h>
#include <stdlib.h>
int main()
{
// place a information screen at the very top
cout << "+================================================ ==================+" << endl;
cout << "+ +" << endl;
cout << "+ Text Combat Editor Written By Stealth +" << endl;
cout << "+ +" << endl;
cout << "+================================================ ==================+" << endl;
// provide spaces before continuing to print anything else
cout << "\n";
cout << "\n";
//=========================== declare all variables here =======================
// make a short int to store the value of the character stats
short int enemy_health = 100 , player_health = 100;
short int enemy_size = 1 , player_size = 1;
short int enemy_speed = (enemy_health - enemy_size);
short int player_speed = (player_health - 50);//player_size);
// symbolic variables for use of evaluation outcome for all equations
short int use = 1;
short int not = 0;
// names for the characters variables as char
char player[7] = "Player";
char enemy[6] = "Enemy";
// values which will be checked to determine who starts the match
int player_start;
int enemy_start = use;
//==================== variable declaration ends here ==========================
//========================= print character stats ==============================
cout << "STATS :\n";
cout << "\n";
cout << "Player Health = " << player_health << endl;
cout << "Enemy Health = " << enemy_health << endl;
cout << "\n";
cout << "\n";
//======================= print character stats ends here ======================
//============ speed check ( determining who starts the match ) ===============
// check if player is faster then the enemy
if (player_speed > enemy_speed)
// set player start to use
player_start = use;
// check if enemy is faster then player
if (enemy_speed > player_speed)
enemy_start = use;
// check if enemy and player speeds are equal,if they are player has the right to start
if (player_speed = enemy_speed)
player_start = use;
if (player_start = use)
enemy_start = not;
else
if (enemy_start = use)
player_start = not;
//=========================== speed check ends here ============================
//=================== print who starts the match ===============================
if (player_start = use)
cout << "Player is faster\n" << "You will start the match\n";
else
if (enemy_start = use)
cout << "Enemy is faster \n" << "He will start the match \n";
//=================== print who starts match ends here =========================
system("PAUSE");
return 0;
}
what I actually done here was test it to see if it would print
"Enemy Is Faster "
"He Will Start The Match"
But it always seems to print
"Player Is Faster"
"You Will Start The Match"
plz can somebody plz help me out here
cheers
stealth