#include<iostream>
#include<string>
using namespace std;
void upper_string(const char* input, char* out)
{
unsigned int len = strlen(input);
for (unsigned int i=0; i<len; i++)
{
out[i]=(char)toupper(input[i]);
}
out[len]='\0';
}
void lower_string(const char* input, char* out)
{
unsigned int len = strlen(input);
for (unsigned int i=0; i<len; i++)
{
out[i]=(char)tolower(input[i]);
}
out[len]='\0';
}
int main()
{
char* astring = "Hello World";
char result[20];
lower_string(astring,result);
cout<<result<<endl;
upper_string(astring,result);
cout<<result<<endl;
return 0;
}
网友评论