//print freqs for(j=0; j

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 16PE
icon
Related questions
Question

I need to tranform this file from C to C++

//print freqs
for(j=0; j<size; j+){
if(freq[j]!=0}{
printf("%c' is repeated %d times. \n\n", list[j],freqli]);
}
}
return;
Transcribed Image Text://print freqs for(j=0; j<size; j+){ if(freq[j]!=0}{ printf("%c' is repeated %d times. \n\n", list[j],freqli]); } } return;
/sort datafile1 frequency
Hinclude <stdio.h>
#include <stdlib.h>
include <string.h>
*function prints frequency of list*/
void freqCount(char list[], int size){
int freq[size];
int count, j, i = 0;
for(i=0; i<size; i++){
freq[i)= -1;
//count frequencies
for(j=0; j<size; j++){
//count each number at least once
count = 1;
for(i=j+1; i<size; i++}{
//compare values
if(list[j] == list[i]}{
count++;
//if repeated set repeated numbers' freq to 0
freq[i]=0;
}
}
//store each frequency once
/if freq[j]!=0 then that number hasn't been recorded yet
if(freq[j] != 0}{
freqlj]=count;
}
}
Transcribed Image Text:/sort datafile1 frequency Hinclude <stdio.h> #include <stdlib.h> include <string.h> *function prints frequency of list*/ void freqCount(char list[], int size){ int freq[size]; int count, j, i = 0; for(i=0; i<size; i++){ freq[i)= -1; //count frequencies for(j=0; j<size; j++){ //count each number at least once count = 1; for(i=j+1; i<size; i++}{ //compare values if(list[j] == list[i]}{ count++; //if repeated set repeated numbers' freq to 0 freq[i]=0; } } //store each frequency once /if freq[j]!=0 then that number hasn't been recorded yet if(freq[j] != 0}{ freqlj]=count; } }
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning