Can someone help me revise this code?
It isn't compiling.
#include "stdafx.h"
#include
using namespace std;
int main()
{
string yourName;
cout<<"Enter your first name:"<>yourName;
if (string = "emily")
{
cout<<"Hello"<
Still Need Help?
Join the QuestionCove community and study together with friends!
Sign Up
OpenStudy (anonymous):
if (yourName == "Emily")
note that there is two equals
and you use the word yourName not String
but to compare strings you can use :
strcmp (yourName , "Emily");
because it compares the content not the pointers.
to use it include the string.h header file
OpenStudy (anonymous):
Qustion for you sir. What coding language is this.
OpenStudy (anonymous):
C++
OpenStudy (anonymous):
instead of using strcmp from <cstring>, you may also use string::compare
OpenStudy (anonymous):
Well what's the compilation error? Usually the errors say straight away what the problem is.