Answer to Question #51264 in C++ for Zexy

Question #51264
In the You Do It section of this chapter you wrote a program named MaskConvertLetter
that accepts a user’s lowercase letter and converts it to its uppercase equivalent. Now
write a similar program that uses a mask to convert a user’s uppercase entry to its lower-
case equivalent. Save the file as MaskConvertLetter2.cpp.
1
Expert's answer
2015-03-11T06:15:16-0400
.......................................................................................................................
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <cctype>
using namespace std;
int main(){
string letter;
cout<<"Enter a letter : ";
getline(cin, letter);
cout<<"You entered : ";
cout<<letter<<endl;
for(int i = 0; i < letter.size(); i++)
letter[i] = toupper(letter[i]);
cout<<"Uppercase equivalent : "<<letter<<endl;
system&#40;"pause"&#41;;
return 0;
}
.......................................................................................................................
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <cctype>
using namespace std;
int main(){
string letter;
cout<<"Enter a letter : ";
getline(cin, letter);
cout<<"You entered : ";
cout<<letter<<endl;
for(int i = 0; i < letter.size(); i++)
letter[i] = tolower(letter[i]);
cout<<"Lowercase equivalent : "<<letter<<endl;
system&#40;"pause"&#41;;
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
APPROVED BY CLIENTS