Frequency of Numbers in a 1D Array

前端 未结 6 422
清酒与你
清酒与你 2021-01-27 03:54

its been 6 hours since I have been writing the code but to no avail, I don\'t no where I am making the mistake but I am making some. Its a frequency output program and output sh

6条回答
  •  逝去的感伤
    2021-01-27 04:10

    I wanted to submit my solution which I think it´s a more easy one:

    #include 
    using namespace std;
    
    int main() {
        int n; //number of Elements in the vector
        cin>>n;
        int vec[n]; //vector with all elements
        int v[n];  //vector with Elements without repetition
        int c[n];  // vector which stores the frequency of each element
        for(int i=0; i>vec[i];
        int k=0; // number of Elements of the vector without Repetition, in the begining, it has 0 Elements
        int j=0; //logic Counter, could be replaced with bool
        for(int i=0; i

提交回复
热议问题