string in function

Main idea is to make function that will include string, and I don't Know what
I need to fix.

#include <iostream>
#include <string>

using namespace std;

void color (string x)
{
cout << "Color of your dog is: " << x ;
}

int main()
{
cout << "Choose your color." << endl ;
color(red) ;
return 0;
}


#include <iostream>
#include <string>

using namespace std;

void color (string x)
{
cout << "Color of your dog is: " << x ;
}

int main()
{
cout << "Choose your color." << endl ;
color(red) ;
return 0;
}

'red' was not declared in this scope
strings must be in quotes, is all. try "red" here:

int main()
{
cout << "Choose your color." << endl ;
color(red) ;
return 0;
}
Topic archived. No new replies allowed.