Question: C++ coding. please help me fix code for correct output. this program that counts chars in array. the program is able to count the a's

C++ coding. please help me fix code for correct output. this program that counts chars in array. the program is able to count the a's and b's but for some reason not c's. Please fix error and explain.

Expected input:

10

aaaabbbccc

Expected output:

aaaabbbccc

a4b3c3

current output:

aaaabbbccc

a4b3

current code:

#include #include using namespace std;

int main(){ int size; cin>>size; char* arr =new char[size];

for(int i =0; i>arr[i]; } for(int i =0; i

} } return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!