Question: Convert C++ program spaghetti code to modular code Program: #include #include #include #include using namespace std; int main() { string fn; char c; int counters[256],
Convert C++ program spaghetti code to modular code
Program:
#include#include #include #include using namespace std; int main() { string fn; char c; int counters[256], max = 0, totalbytes = 0; // keep track of how many of each char (0 to 255) in counters for (int i = 0; i > fn; ifstream ifs; ifs.open (fn, ios::in | ios::out | ios::binary); if (!ifs.is_open()) { cout max) max = counters[i]; // Plot the distribution after applying scaling for (int i = 0; i
OUTPUT:
* ********* Enter filename: C:\Users\Acer\Desktop\1.png a ******************************************* 1 ******************** 2 *************************** 3********************* 4 ******************************* ************************ S ********************** 9 ************************** L 8 ***************************** ************************** 6 **************************** L 11 ************** 12 ************************** 13***************** 14 *************************** 15 ****** 16 **************************** **************************** LL ******************************* L **************************** 6L ******************************* 21 *************************** 22 ************************** 23 **************** 24 25 ************************* 26 *************************** 27 ***************** 28 ******************** 29 ****************** 38 ******************* 31 ***************** 32 33 **************** 34 ******** 35 ***** * * 36 ******************************* 37***************************** 38 **************************** 223 ******************************* 224 *************************** 225 ***************************** 226 **************************** 227 ********************************* 228 ************************** 229 **** 230 ********************************* 231 **** 232 233 ******************************** 234 ************************** 235 236 **************************** 237*************************** 238 ********************************** 239 ******************************* 248 ******* 241 ****************************** 242 ****************************** 243 ********************************** 244 ************************* 245 ***************************** 246 ***************************** 247 ******************************** 248 *************************** 249 ******* 250 251 ******************************* ***************************** ZGZ ********************************* ESC ******************************** S ****************************** SSZ Max count: 3867 Legend: * = 39 bytes Total:284933 Process returned o (Oxo) execution time:27.664 s Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock


