I'm presently studying C++ and have completed the following task in which I must transform an array from uppercase to lowercase and vice versa:
int main()
{
char str[100];
cout << "Enter anything: ";
cin.getline(str, 100);
//upper to lower vice versa
for (int i = 0; i < 100; i++) {
if (str[i] == 0x20)
{
continue;
}
str[i] ^= 0x20;
}
cout << "output: " << str;
return 0;
}
However, they want me to use the new[] and delete[] operators instead of declaring the numbers in an array, which is what this portion char str[100]; does. I've attempted to use it, but the notion confuses me. Is there anything you might suggest? Any assistance will be much appreciated! Thank you so much in advance!