// open input file
ifstream fin; //
fin.open (usersFile.c_str()); //
if (!fin.good()) throw "I/O error"; //
// open output file
ofstream fout;
fout.open ("secret.txt");
if (!fout.good()) throw "I/O error" ; //
//input line
while (fin.good())
{
getline(fin, usersFile);
// encode string s by adding 1 to the ASCII code of each character
for (i = 0; i < codedMsg.length(); i=i+1)
{
codedMsg[i] = codedMsg[i] + 1; // bump the ASCII code by 1
}//for i
Put the code you need help with here.
lab2.cpp:63:30: error: request for member 'length' in 'codedMsg', which is of non-class type 'std::string()' {aka 'std::__cxx11::basic_string<char>()'}
63 | for (i = 0; i < codedMsg.length(); i=i+1)
| ^~~~~~
lab2.cpp:65:17: warning: pointer to a function used in arithmetic [-Wpointer-arith]
65 | codedMsg[i] = codedMsg[i] + 1; // bump the ASCII code by 1
| ^
lab2.cpp:65:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
65 | codedMsg[i] = codedMsg[i] + 1; // bump the ASCII code by 1
| ^
lab2.cpp:65:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
65 | codedMsg[i] = codedMsg[i] + 1; // bump the ASCII code by 1
| ~~~~~~~~~~~~^~~
lab2.cpp:65:19: error: assignment of read-only location '*(codedMsg + ((sizetype)i))'
65 | codedMsg[i] = codedMsg[i] + 1; // bump the ASCII code by 1