In a bank there are two types of transactions: credit and debit. All transactions are assigned an alphabetical ID. Credit transactions are assigned a vowel and debit transactions are assigned a consonant. To track transactions over a year, all the transaction IDs are combined to form a string of IDs for each customer. A customer wishes to know the number of times he made a debit transaction immediately after a credit transaction.
Write an algorithm to print the count of debit transactions that were made immediately after a credit transaction for that particular customer.
Input
The first line of the input consists of a string userString, representing the string of transaction IDs.
Output
#include <iostream>
using namespace std;
int main()
{
int c;
cout<<"\nChoose type of transaction:\n1. Credit \n2. Debit\n";
cin>>c;
char id_c;
char id_d;
int count=1;
if (c==1){
id_c='a';
count=1;
}
else if(c==2){
id_d='b';
}
cout<<count;
return 0;
}
Comments
Leave a comment