I haven't programmed in some time and need some help here plz. First of all how are individual characters of a string are accessed? second do they start at 0 or 1? I'm probably confusing this with arrays please help me out :). This program will read in a line of text, add "[ b ]" before, add "[ /b ]" after and will replace every letter of the read in string with 1 or 2 letters or a symbol. I dont want any help with the structure of the code I need to get rid of the compiler error:
line 8
1. invalid conversion from `char' to `const char*'
2. initializing argument 1 of `std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]'
int main (){
string line1, line2;
int numberofwords;
cin >> line1;
numberofwords = line1.length();
line2 = "[b]";
for(int i = 0; i = numberofwords; i++){
line2 += converter(line1[i]);
}
line2 += "[/b]";
cout << line2;
system("pause");
return 0;
}