boost::algorithm::to_upper
is declared as (from boost reference)
template<typename WritableRangeT>
void to_upper(WritableRangeT & Input, const std::locale & Loc = std::locale());
so you can pass only one string to this function. Replacing
boost::to_upper(city1, city2);
with
boost::to_upper(city1);
boost::to_upper(city2);
makes the code compile and an example output is Please enter your citys namePlease enter your citys second nameosLONDON
.
It lacks newline characters and there is one more mistake - misunderstanding of comma operator. Generally comma is used to separate arguments or array elements but in lines
cout << city1 [0,1,2,3,4];
cout << city2 [0,1,2,3,4];
// ...
cout << city1,city2;
comma operator is used. Comma operators takes two operands and it's value is value of the right operand (e.g. after int x = (1, 2);
variable x
is equal to 2). Code above is equivalent to
cout << city1[4];
cout << city2[4];
// ...
cout << city1;
city2;
Finally, the corrected code is
#include <iostream>
#include <string>
#include <boost/algorithm/string.hpp>
using namespace std;
int main() {
string city1, city2;
cout << "Please enter your citys name" << std::endl;
cin >> city1;
cout << "Please enter your citys second name" << std::endl;
cin >> city2;
cout << city1 << std::endl;
cout << city2 << std::endl;
boost::to_upper(city1);
boost::to_upper(city2);
cout << city1 << std::endl << city2 << std::endl;
}