Code:
#include <iostream>
#include <string>
using namespace std;
void WhatToDo()
{
cout << "What do you want to do?\n\n";
}
void OpenGate()
{
cout << "You open the gate and step inside the yard. You marvel at the fact that even\n";
cout << "though this yard is tiny, there has apparently been no effort expended toward\n";
cout << "it's upkeep. You hear what could be muffled growling coming from your left.\n\n";
WhatToDo();
}
int main()
{
string a;
cout << "You are standing in front of a run-down house. There is a blue sportscar that\n";
cout << "looks like it hasn't been driven in years, parked out front. The car is covered\n";
cout << "in leaves. The house itself looks like it could collapse at any moment.\n";
cout << "There is a chain-link fence surrounding the house. The house has a screened-in\n";
cout << "porch, but you can't see much beyond that. Planted in the yard are trees which,\n";
cout << "if properly pruned, were probably nice bushes at one time. There is a closed\n";
cout << "gate which leads through the fence.\n\n";
WhatToDo();
cin >> a;
if (a="open gate")
OpenGate();
else cout << "Please enter a valid command.\n";
return 0;
}
My error message:
Code:
--------------------Configuration: Hello - Win32 Debug--------------------
Compiling...
Hello.cpp
C:\Documents and Settings\Tarthus\Desktop\Hello.cpp(34) : error C2451: conditional expression of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' is illegal
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.
Hello.exe - 1 error(s), 0 warning(s)