consider two classes to store the names of people.class NAME will store the name in upper case and class name will store in lower case. write a program to convert the uppercase name to a lowercase name using the both at source and destination method
#include<iostream>
#include<string>
using namespace std;
class NAME{
public:
string N;
string DISPLAY(){
cout<<N<<endl;
}
};
class name{
string n,N;
public:
string upper(){
cout << "\nPlease Enter the String to Convert into Uppercase = ";
getline(cin,n);
for (int i = 0; i <n.length(); i++)
{
N[i] = toupper(n[i]);
}
return N;
}
};
int main()
{
name m;
NAME M;
M.N=m.upper();
cout<<M.N<<endl;
return 0;
}
Comments
Leave a comment