//Todd Dunaway
//10/30/2014
//Chapter 4: If - Else Statements Program 4
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
int birthyear;
string favfruit, beatlesfruit;
beatlesfruit="strawberry";
cout<<"In what year were you born?";
cin>>birthyear;
cout<<endl;
if(birthyear<1970)
cout<<"You qualify for the Juke Box Rally.";
cout<<"What is your favorite fruit? ";
cin>>favfruit;
if(favfruit=beatlesfruit)
cout<<"Strawberry Fields Forever";
else
cout<<"Bye, Bye Miss American Pie"<<endl;
return 0;
}
I am getting an error at "if(favfruit=beatlesfruit)".
The error I am getting is: Chapter 4 If - Else Statements Program 4.cpp:20:27: error: could not convert 'favfruit.std::basic_string<_CharT, _Traits, _Alloc>::operator=<char, std::char_traits<char>, std::allocator<char> >((*(const std::basic_string<char>*)(& beatlesfruit)))' from 'std::basic_string<char>' to 'bool'