Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Write a program named alphabets.cpp as follows. The program prompts the user

ID: 3859820 • Letter: C

Question

C++

Write a program named alphabets.cpp as follows.

The program prompts the user to enter three unique lowercase alphabets.

The program validates the input for the count, case, and uniqueness of the alphabets.

In the final report, the program prints the three characters it has received. If any of the criteria is not satisfied, prints out one of the following messages.

"You have entered fewer than three characters. Please run the program again and enter three unique lowercase alphabets."

"You have not entered lowercase alphabets. Please run the program again and enter three unique lowercase alphabets."

"You have not entered unique lowercase alphabets. Please run the program again and enter three unique lowercase alphabets."

Explanation / Answer

#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main() {

string input = "";

cout << "Enter three unique lowercase alphabets: >";
getline(cin, input);
cout << "You entered: " << input << endl << endl;

if(input.length()==3)
{
int count=0;
for(int i=0;i<input.length();i++){   
for(int j=0;j<i;j++){
if(input[i]==input[j]){
count++;   
}

}
  
}
if(count==0){
for(int i=0;i<=input.length();i++)
{
if(isupper(input[i]))
{
cout<<"You have not entered lowercase alphabets. Please run the program again and enter three unique lowercase alphabets.";
break;
}
else
{

}
  
}
  
}
else
{
cout<<"You have not entered unique lowercase alphabets. Please run the program again and enter three unique lowercase alphabets.";
return 0;
}
  
}

else
{
cout<< "You have entered fewer than three characters. Please run the program again and enter three unique lowercase alphabets.";
}
  
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote