Hey guys,
Im pretty new to c ++ and was just wonderiing if anyone could quuckly correct my conversion function I have and tell me how it should be as it is not working.
Thanks kindly
Code:
//<-Libs----||
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <windows.h>
#include <algorithm>
#include <string>
#include <cctype>
//--Files-->>
#include "Classes.h"
#include <stdio.h>
#include <ctype.h>
//---------<<
using namespace std;
string playerInName; // Declares variables.
string playerInAge;
string playerInOrigin;
string playerInPet;
string helpAnswer;
int petChoice;
int main()
{
cout << "Welcome to the C++ Adventure Game Version 1.\nBy Darryl Mitchell \n\n"; // Introduces the game
cout << "Please enter your name: "; // Takes details from the
cin >> playerInName; // player and stores them
cout<< "Now your age: "; // for later use.
cin >> playerInAge;
cout << "Lastly; please enter your place of origin: ";
cin >> playerInOrigin;
cout << "\nNo great adventurer is complete without their trusty companion!\nWhich do you have? A Dog, Cat or an Eagle? ";
cin >> playerInPet;
//------------------ ISSUE -------------------------------------//
string data = playerInPet;
transform(data.begin(), data.end(),
data.begin(), ::tolower);
//--------------------------------------------------------------//
while((playerInPet != "cat") && (playerInPet !="dog")&& (playerInPet != "eagle"))
{
cout << "Ahahah dont be foolin' me! There are no such companions! \nPlease re-validate your companion!\n";
cin >> playerInPet;
if(playerInPet == "cat")
{petChoice = 1;}
if(playerInPet == "dog")
{petChoice = 2;}
if(playerInPet == "eagle")
{petChoice = 3;}
}