Question: 1. Modify the main() method such that the array arr only contains letters from A to Z. 2. Write void count(char* arr, int n, int*

1. Modify the main() method such that the array arr only contains letters from A to Z. 2. Write void count(char* arr, int n, int* counts) that returns the count of each letter in the array. 3. Save this function in count.cpp file. 4. Create a Makefile with following targets: all clear arr 5. The Makefile should compile the arr executable from count.cpp and main.cpp file. The skeleton for the main.cpp file is provided below. main.cpp file The following file uses random number generator to fills an array arr with random values. The random values lie between 0 and RAND_MAX. #include #include #include #include using namespace std; int main(int argc, char** argv) { if (argc < 2) { cerr << "Usage: " << argv[0] << " " << endl; cerr << "\t is an integer between 10 and 10000 "; cerr << "\tExiting.";

return -1; } int n = atoi(argv[1]); if (n < 10 || n > 10000) { cerr << "Usage: " << argv[0] << " " << endl; cerr << "\t is an integer between 10 and 10000 "; cerr << "\tExiting."; return -2; } srand(time(NULL)); ////////////////////////////////////////////// // // TODO // Change the following line to char* arr = new char[n]; // ////////////////////////////////////////////// int* arr = new int[n]; ////////////////////////////////////////////// // // TODO // Change the following lines such arr // contains letter A - Z. The letters will be // a randomly generated. // ////////////////////////////////////////////// for (int i=0; i

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!