#include <iostream>
#include <cstring>
#include <string>
usingnamespace std;
void reverse(char*);
int main()
{
constint size = 100;
char c[size];
cout << "Please enter a string." << endl;
cin.getline(c, size);
reverse( c ); // <===== function call, not function prototype
return 0;
}
void reverse(char* c)
{
for (int i = 0; c[i] != '\0'; i++) // <===== Null-terminated
{
// <=== Your outer loop would have changed lower case only, so removed
//
if (isupper(c[i]))
{
c[i] = tolower(c[i]); // <====== You have to actually ASSIGN to c[i]
} // to get an updated value
elseif (islower(c[i]))
{
c[i] = toupper(c[i]); // <====== Likewise, you have to assign to c[i]
}
// <===== end of loop removed
}
cout << "The new string is " << c << endl;
}