Homework Solution: 1. Write a C++ program to perform the following tasks. Define an array of characters of size 15. Read 1…

    1. Write a C++ program to perform the following tasks. Define an array of characters of size 15. Read 15 characters from the user into the array. Next, read a search character from the user. The program should search for this character in the array. If found, report so, and also report the number times the search character occurs in the input array. Finally, the program should report what other character(s) in the input array occur(s) the same number of times as the search character. Suppose that your 15 character input is “aaaabbbbccccdef”, and the search character is ‘a’. Your program would state that ‘a’ is present in the input and that it occurs 4 times. It would also output stating that “The characters ‘b’ and ‘c’ occur the same number of times as that of ‘a’”.

    Expert Answer

     
    PROGRAM CODE: #include <iostream> using namespace std;

    1. Write a C++ program to effect the subjoined tasks. Define an adorn of symbols of bigness 15. Peruse 15 symbols from the user into the adorn. Next, peruse a quest symbol from the user. The program should quest ce this symbol in the adorn. If institute, repute so, and besides repute the compute times the quest symbol happens in the input adorn. Finally, the program should repute what other symbol(s) in the input adorn happen(s) the selfselfsimilar compute of times as the quest symbol. Suppose that your 15 symbol input is “aaaabbbbccccdef”, and the quest symbol is ‘a’. Your program would declare that ‘a’ is offer in the input and that it happens 4 times. It would besides output stating that “The symbols ‘b’ and ‘c’ happen the selfselfsimilar compute of times as that of ‘a’”.

    Expert Exculpation

     

    PROGRAM CODE:

    #include <iostream>

    using namespace std;

    int main() {

    char quotation[15], quest;

    cout<<“Enter the quotation: “;

    cin>>text;

    cout<<“nEnter the quest symbol: “;

    cin>>search;

    int reckon = 0;

    for(int i=0; quotation[i] != ‘’; i++)

    {

    if(text[i] == quest)

    {

    count++;

    }

    }

    if(reckon == 0)

    cout<<endl<<search<<” was not attributable attributable attributable institute.”<<endl;

    else

    {

    cout<<endl<<quest <<” was institute “<<count<<” times”<<endl;

    }

    char moreSearches[15];

    int bigness = 0;

    for(int i=0; quotation[i] != ‘’; i++)

    {

    if(text[i] == quest || quotation[i] == ‘-‘)

    continue;

    int subReckon = 0;

    for(int j=0; quotation[j] != ‘’; j++)

    {

    if(text[i] == quotation[j])

    {

    text[j] = ‘-‘;

    subCount++;

    }

    }

    if(subReckon == reckon)

    moreSearches[size++] = quotation[i];

    }

    if(bigness > 0)

    {

    cout<<“The symbols “;

    for(int i=0; i<size; i++)

    {

    cout<<moreSearches[i]<<“, “;

    }

    cout<<” happen the selfselfsimilar compute of times as “<<search;

    }

    else cout<<“No other symbol appears the selfselfsimilar compute of times as “<<search<<endl;

    return 0;

    }