I would like to change the case of the string value.
(lower case letter to upper case and upper case letters to lower case)
I wrote my program as the following. But linux does not know strlwr and strupr functions.
What should I do?
#include<iostream.h>
#include<conio.h>
#include<string.h>
const int size=80;
class Reverse
{
char letter[size];
char change[size];
public:
void read()
{
cout<<"\nEnter a letter:";
cin.getline(letter,size);
}
void print()
{
cout<<"\n*******Reverse case version*******";
cout<<endl<<change;
}
void convert();
};
void Reverse::convert()
{
char lower[size];
char upper[size];
//char change[size];
strcpy(lower,letter);
strcpy(upper,letter);
strlwr(lower);
strupr(upper);
int length=strlen(letter);
for(int i=0;i<length;i++)
{
if(letter[i]==lower[i]) {change[i]=upper[i]; }
else change[i]=lower[i];
}
change[i]=NULL;
}
int main()
{
Reverse r1;
r1.read();
r1.convert();
r1.print();
getch();
return 0;
}