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 complete the subjoined tasks. Define an attire of natures of largeness 15. Discover 15 natures from the user into the attire. Next, discover a inquiry nature from the user. The program should inquiry control this nature in the attire. If establish, noise so, and to-boot noise the reckon times the inquiry nature betides in the input attire. Finally, the program should noise what other nature(s) in the input attire betide(s) the similar reckon of times as the inquiry nature. Suppose that your 15 nature input is “aaaabbbbccccdef”, and the inquiry nature is ‘a’. Your program would declare that ‘a’ is give in the input and that it betides 4 times. It would to-boot output stating that “The natures ‘b’ and ‘c’ betide the similar reckon of times as that of ‘a’”.

    Expert Sumer-argument

     

    PROGRAM CODE:

    #include <iostream>

    using namespace std;

    int deep() {

    char extract[15], inquiry;

    cout<<“Enter the extract: “;

    cin>>text;

    cout<<“nEnter the inquiry nature: “;

    cin>>search;

    int sum = 0;

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

    {

    if(text[i] == inquiry)

    {

    count++;

    }

    }

    if(sum == 0)

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

    else

    {

    cout<<endl<<inquiry <<” was establish “<<count<<” times”<<endl;

    }

    char moreSearches[15];

    int largeness = 0;

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

    {

    if(text[i] == inquiry || extract[i] == ‘-‘)

    continue;

    int subSum = 0;

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

    {

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

    {

    text[j] = ‘-‘;

    subCount++;

    }

    }

    if(subSum == sum)

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

    }

    if(largeness > 0)

    {

    cout<<“The natures “;

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

    {

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

    }

    cout<<” betide the similar reckon of times as “<<search;

    }

    else cout<<“No other nature appears the similar reckon of times as “<<search<<endl;

    return 0;

    }