Answer to Question #203544 in C++ for harshitha p

Question #203544

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


1
Expert's answer
2021-06-05T23:51:23-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog