I wanted to write a function for tolower() in c++ without using STL. When I am giving small inputs like "Hello" , I am getting correct output with my code but when I am giving input with large paragraphs which has punctuations in it , then I am getting error. Can anyone help to fix and help to understand why I am getting Error?
My code :
#include <iostream>
using namespace std;
int main()
{
std::string str[] = ""Mymommaalwayssaid,\"Lifewaslikeaboxofchocolates.Youneverknowwhatyou'regonnaget.""
int n ,i;
string UP[str.size()];
for(int i=0;i<=str.size();i++)
{
if(int(str[i])<=90 && int(str[i])>=65)
{ n = int(str[i]);
n= n+32;
UP[i]=char(n);
}
else
UP[i] = str[i];
}
cout<<UP<<endl;
return 0;
}