Here is the full code that I want to use tolower() on:
Code:
#include <iostream>
#include <algorithm> //All of the files needed to run the program
#include <cctype>
#include <iostream>
#include <string>
#include <windows.h>
#include <stdio.h> //Plus alot more
#include <locale>
#include <math.h>
using namespace std;
float experience;
int Hp, level, attack, defence, enemyHp = 50, enemyattack, enemydefence, afterattack = 0, battleloop = 0;
int main()
{
std::string mmchoice;
int y = 0,z = 0, smenuloop = 0;
string battlechoice, smenuchoice; //Variables
float experience;
int Hp, level, attack, defence, enemyHp = 50, enemyattack, enemydefence, afterattack = 0, battleloop = 0;
cout<<"Press ENTER.";
cin.ignore();
for ( int x = 500; x < 537; x++ ) {
for ( int y = 0; y< 90; y++){
y = y + 14;
x = x + 20;
for(int ldloop = 0; ldloop < 21; ldloop++){
cout<<endl;
}
Sleep(2000);//2000
cout<<"Loading file directories( "<< x <<" of 640)"<<endl;
cout<<"Reaching files to load program...\n";
cout<<"Progress: "<< y <<"% complete\n";
}
for(int ldloop = 0; ldloop < 21; ldloop++){
cout<<endl;
}
Sleep(2000);
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
Sleep(1500);
cout<< x <<" files out of 640 files accessed.\n";
Sleep(1500);
cout<<"89 percent complete.\n";
Sleep(1500);
cout<<"Recovering files";Sleep(1000);cout<<".";Sleep(1200);cout<<".";Sleep(2000);cout<<".";Sleep(700);cout<<"\n\n\n\n";
Sleep(1000); cout<<"Finishing process.\n"; Sleep(5000);/*5000*/ cout<<"Process complete.\n";
}
Sleep(500);
cout<<"Press ENTER to continue.";
cin.ignore();
for(int ldloop = 0; ldloop < 15; ldloop++){
cout<<endl;
} cout<<"\n\n\n";
cout<<" Welcome to RPG Maina!\n\n\n\n\n\n";
do{ // This begins the loop or repeatable program
cout<<"Please enter an attribute. Then press ENTER.\nThe choices are: \nSteel\nDragon\nFighting\n";
for(int ldloop = 0; ldloop < 7; ldloop++){
cout<<endl;
}
cout<<"______________________\n";
cout<<"type: ";
getline(std::cin, mmchoice);
for(int endloop = 0; endloop < 22; endloop++){
cout<<endl;
}
{ //Within this proccess, the program shows a reading and loading text.
cout<<"\n"; cout<<"analizing"; Sleep(900); cout<<"."; Sleep(600); cout<<".";
Sleep(800); cout<<".\n"; Sleep(500); cout<<"\n"; cout<<"\n"; cout<<"loading";
Sleep(500); cout<<"."; Sleep(500); cout<<"."; Sleep(500); cout<<".\n";
for(int ldloop = 0; ldloop < 15; ldloop++){
cout<<endl;
}
Sleep(500);
}
if(mmchoice == "steel"){
y = 0;
level = 1;
experience = 0;
Hp = 100;
attack = 10;
defence = 20;
enemyattack = defence + 7;
enemydefence = attack - 4;
cout<<"Here are the character stats for Steel: \n"<<endl;
cout<<"Level: "<<level<<"\n";
cout<<"Experience: "<<experience<<"\n";
cout<<"Hp: "<<Hp<<"\n";
cout<<"Attack: "<<attack<<"\n";
cout<<"Defence: "<<defence<<"\n";
}
else if(mmchoice == "Steel"){
y = 0;
level = 1;
experience = 0;
Hp = 100;
attack = 10;
defence = 20;
enemyattack = defence + 6;
enemydefence = attack - 5;
cout<<"Here are the character stats for Steel: \n"<<endl;
cout<<"Level: "<<level<<"\n";
cout<<"Experience: "<<experience<<"\n";
cout<<"Hp: "<<Hp<<"\n";
cout<<"Attack: "<<attack<<"\n";
cout<<"Defence: "<<defence<<"\n";
}
else if(mmchoice == "STEEL"){
y = 0;
level = 1;
experience = 0;
Hp = 100;
attack = 10;
defence = 20;
enemyattack = defence + 8;
enemydefence = attack - 3;
cout<<"Here are the character stats for Steel: \n"<<endl;
cout<<"Level: "<<level<<"\n";
cout<<"Experience: "<<experience<<"\n";
cout<<"Hp: "<<Hp<<"\n";
cout<<"Attack: "<<attack<<"\n";
cout<<"Defence: "<<defence<<"\n";
}
else if(mmchoice == "dragon"){
y = 0;
level = 1;
experience = 0;
Hp = 100;
attack = 15;
defence = 15;
enemyattack = defence + 7;
enemydefence = attack - 4;
cout<<"Here are the character stats for Dragon: \n"<<endl;
cout<<"Level: "<<level<<"\n";
cout<<"Experience: "<<experience<<"\n";
cout<<"Hp: "<<Hp<<"\n";
cout<<"Attack: "<<attack<<"\n";
cout<<"Defence: "<<defence<<"\n";
}
else if(mmchoice == "Dragon"){
y = 0;
level = 1;
experience = 0;
Hp = 100;
attack = 15;
defence = 15;
enemyattack = defence + 8;
enemydefence = attack - 3;
cout<<"Here are the character stats for Dragon: \n"<<endl;
cout<<"Level: "<<level<<"\n";
cout<<"Experience: "<<experience<<"\n";
cout<<"Hp: "<<Hp<<"\n";
cout<<"Attack: "<<attack<<"\n";
cout<<"Defence: "<<defence<<"\n";
}
else if(mmchoice == "DRAGON"){
y = 0;
level = 1;
experience = 0;
Hp = 100;
attack = 15;
defence = 15;
enemyattack = defence + 6;
enemydefence = attack - 5;
cout<<"Here are the character stats for Dragon: \n"<<endl;
cout<<"Level: "<<level<<"\n";
cout<<"Experience: "<<experience<<"\n";
cout<<"Hp: "<<Hp<<"\n";
cout<<"Attack: "<<attack<<"\n";
cout<<"Defence: "<<defence<<"\n";
}
else if(mmchoice == "fighting"){
y = 0;
level = 1;
experience = 0;
Hp = 100;
attack = 20;
defence = 10;
enemyattack = defence + 8;
enemydefence = attack - 3;
cout<<"Here are the character stats for Fighting: \n"<<endl;
cout<<"Level: "<<level<<"\n";
cout<<"Experience: "<<experience<<"\n";
cout<<"Hp: "<<Hp<<"\n";
cout<<"Attack: "<<attack<<"\n";
cout<<"Defence: "<<defence<<"\n";
}
else if(mmchoice == "Fighting"){
y = 0;
level = 1;
experience = 0;
Hp = 100;
attack = 20;
defence = 10;
enemyattack = defence + 6;
enemydefence = attack - 5;
cout<<"Here are the character stats for Fighting: \n"<<endl;
cout<<"Level: "<<level<<"\n";
cout<<"Experience: "<<experience<<"\n";
cout<<"Hp: "<<Hp<<"\n";
cout<<"Attack: "<<attack<<"\n";
cout<<"Defence: "<<defence<<"\n";
}
else if(mmchoice == "FIGHTING"){
y = 0;
level = 1;
experience = 0;
Hp = 100;
attack = 20;
defence = 10;
enemyattack = defence + 7;
enemydefence = attack - 4;
cout<<"Here are the character stats for Fighting: \n"<<endl;
cout<<"Level: "<<level<<"\n";
cout<<"Experience: "<<experience<<"\n";
cout<<"Hp: "<<Hp<<"\n";
cout<<"Attack: "<<attack<<"\n";
cout<<"Defence: "<<defence<<"\n";
}
else if (mmchoice == "10005686"){
y = 0;
level = 1;
experience = 0;
Hp = 100000;
attack = 10000;
defence = 10000;
enemyattack = 0;
enemydefence = 0;
cout<<"Here are the character stats for The Secret Samurai: \n"<<endl;
cout<<"Level: "<<level<<"\n";
cout<<"Experience: "<<experience<<"\n";
cout<<"Hp: "<<Hp<<"\n";
cout<<"Attack: "<<attack<<"\n";
cout<<"Defence: "<<defence<<"\n";
}
else{
y = y + 1;
cout<<"ERROR. incorrect input.\n";
if(y == 2){
cout<<"Just enter a correct choice already!\n";
}
else if (y == 3){
cout<<"You have GOT to be kidding me!\n";
cout<<"It is not that hard!\n";
}
else if (y == 4) {
cout<<"HOW STUPID ARE YOU!!!!!!!!!!!\n";
}
else if (y == 5) {
cout<<"I give up.\n";
}
for(int endloop = 0; endloop < 5; endloop++){
cout<<endl;
}
cout<<"press ENTER to return to the menu.\n";
cin.ignore();
cout<<"\n\n\n\n\n\n\n\n\n\n";
Sleep(1200);
}
} while(y != 0);
cout<<endl;
cout<<"Press ENTER to continue.\n";
cin.ignore();
cout<<"Waiting for next proccess";
Sleep(1200); cout<<"."; Sleep(700); cout<<"."; Sleep(500); cout<<".\n"; Sleep(1500);
for(int ldloop = 0; ldloop < 18; ldloop++){
cout<<endl;
}
cout<<"Welcome to the status menu!\nWhile here, you can buy items, train, or battle me.\n\n\n\n";
cout<<"Market\n\n"; cout<<"Training arena\n\n"; cout<<"Final Boss\n\n"; cout<<"Press ENTER to go to continue.\n";
cin.ignore(); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
do{
do{
cout<<"Market\n\n"; cout<<"Training arena\n\n"; cout<<"Final Boss\n\n";
cout<<"choice: ";
getline(std::cin, smenuchoice);
if(smenuchoice == "market"){
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
cout<<"Sorry, but the market is currently\nunder construction.\n\n";
cout<<"Press ENTER to return to the menu.";
cin.ignore();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
}
else if(smenuchoice == "Market"){
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
cout<<"Sorry, but the market is currently\nunder construction.\n\n";
cout<<"Press ENTER to return to the menu.";
cin.ignore();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
}
else if(smenuchoice == "MARKET"){
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
cout<<"Sorry, but the market is currently\nunder construction.\n\n";
cout<<"Press ENTER to return to the menu.";
cin.ignore();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
}
else if(smenuchoice == "training arena"){
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
smenuloop = smenuloop + 1;
}
else if(smenuchoice == "Training Arena"){
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
smenuloop = smenuloop + 1;
}
else if(smenuchoice == "TRAINING ARENA"){
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
smenuloop = smenuloop + 1;
}
else if (smenuchoice == "final boss"){
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
cout<<"The Final Boss is currentlly unavailable.\nPlease wait for an update to the game.\n";
cout<<"Press ENTER to return to the menu.";
cin.ignore();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
}
else if (smenuchoice == "Final Boss"){
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
cout<<"The Final Boss is currentlly unavailable.\nPlease wait for an update to the game.\n";
cout<<"Press ENTER to return to the menu.";
cin.ignore();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
}
else if (smenuchoice == "FINAL BOSS"){
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
cout<<"The Final Boss is currentlly unavailable.\nPlease wait for an update to the game.\n";
cout<<"Press ENTER to return to the menu.";
cin.ignore();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
}
else{
cout<<"Incorrect input.";Sleep(2000);cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
}
}while( smenuloop == 0 );
smenuloop = 0;
enemyHp = 50;
battleloop = 0;
cout<<"It is time to train.\nPress ENTER to begin.";
cin.ignore();
cout<<"\n\nPlease wait while the battle system loads.";
for(int ldloop = 0; ldloop < 2; ldloop ++){
Sleep(1200);
cout<<".";
}
Sleep(1200);
for(int ldloop = 0; ldloop < 21; ldloop ++){
cout<<"\n";
}
cout<<"An enemy has appeared.\n";
Sleep(3000);
do{
for(int endloop = 0; endloop < 21; endloop ++){
cout<<"\n";
}
cout<<"The enemy attacks!\n";
afterattack = enemyattack - defence;
Sleep(1000);
cout<<"\n\n\n\n\n\n\n\n\n\n";
Hp = Hp - afterattack;
afterattack = 0;
Sleep(500);
if (Hp <= 0){
battleloop = battleloop + 1;
cout<<"You were slain by the enemy!\n";
}
else{
Sleep(1500);
cout<<"You have "<< Hp <<" Hp\n";
Sleep(2000);
cout<<"Will you attack? Enter yes or no. Then press ENTER.\n";
getline(std::cin, battlechoice);
Sleep(500);
cout<<endl;
if(battlechoice == "yes"){
cout<<"\n\n\n\n\n\n\n\n\n\n";
cout<<"You attack!\n";
Sleep(1000);
afterattack = attack - enemydefence;
enemyHp = enemyHp - afterattack;
cout<<"enemy Hp = "<<enemyHp<<"\n";
Sleep(2000);
if(enemyHp <= 0){
battleloop = battleloop + 1;
cout<<"The enemy ran away!\n";
cout<<"You have earned "<< enemyattack + enemydefence <<" !";
afterattack = enemyattack + enemydefence;
experience = afterattack;
Sleep(1500);
cout<<"Press ENTER to return to the status menu\n";
cin.ignore();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
}
}
else if (battlechoice == "Yes"){
cout<<"\n\n\n\n\n\n\n\n\n\n";
cout<<"You attack!\n";
Sleep(1000);
afterattack = attack - enemydefence;
enemyHp = enemyHp - afterattack;
cout<<"enemy Hp = "<<enemyHp<<"\n";
Sleep(1000);
if(enemyHp <= 0){
battleloop = 1;
cout<<"The enemy ran away!\n";
cout<<"Press ENTER to return to the status menu\n";
cin.ignore();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
}
}
else{
battleloop = battleloop + 1;
cout<<"you chose to return.\n";
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
}
}
}while ( battleloop == 0 );
}while (z == 0);
}
As you can see, the attribute choice you enter is checked to see if it equals steel, Steel, STEEL, dragon, Dragon, DRAGON, fighting, Fighting, FIGHTING.
I wish to use tolower() to change the attribute choice to all lowercase so it will only have to check for steel, dragon, fighting.