You are requested to write an application which ask the user to input 3 alphabets of their choice.
After that continuously ask the user for new alphabet, if all three alphabets of choice are entered
either in a forward sequence or backward, the application ends with telling them how many times
the user has entered each alphabet of the choice.
#include<iostream>
using namespace std;
int main()
{
char a,b,c,n;
cout<<"Enter the three alphabets: ";
cin>>a>>b>>c;
int count=0;
for(int i=0;i<10;i++){
cout<<"Enter an alphabet: "<<i;
cin>>n;
if(n==a&&n==b&&n==c){
n++;
count+=1;
}
count++;
}
cout<<"Number of alphabets are: "<<count;
}
Comments
Leave a comment