Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managing Your Information How To Design And Create A Textual Database On Your Microcomputer

Authors: Tenopir, Carol, Lundeen, Gerald

1st Edition

1555700233, 9781555700232

More Books

Students also viewed these Databases questions