I think you want to output the value that's returned by the diameter function? If yes, you can just call the function in the output statement. The main function doesn't know about the local variable diameter that you declared in the diameter function so you can't cout << diameter in main. Or you could declare a local variable in main function to hold the result of the diameter function.
how do i solve this, im trying to create a program that translates from english to french it is giving me this error " Error 1 error C2664: 'std::basic_string<_Elem,_Traits,_Ax>::basic_string(const std::basic_string<_Elem,_Traits,_Ax> &,unsigned int,unsigned int,const std::allocator<_Ty> &)' : cannot convert parameter 1 from 'std::_String_iterator<_Elem,_Traits,_Alloc>' to 'const std::basic_string<_Elem,_Traits,_Ax> &' " on my program where i have "translate(phrase.begin()"
this is my program:
using namespace std;
map<string, string> dict;
dict["Welcome"] = "bienvenue";
cout<<" Which language would you like to translate from: \n 1: English to French \n 2: French to English \n 3: Exit program"<<endl;
bool finished = false;
if (selection == 1)
cout<<" Please enter the word or sentence you would like to translate: ";
string translate(phrase.begin(), phrase.end(), phrase.begin(), tolower);
if (dict.count(phrase) == 0);