I'm doing a function that identifies me how many times an element is found in a vector, what condition should I put? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

I'm doing a function that identifies me how many times an element is found in a vector, what condition should I put?

#include<iostream> using namespace std; int repeat(int num[], int n){ int can = 0; for(int i=0; i < 5; i++){ if(num[i] == num[i]){ } cout << num[i]; } } int main(){ int vec[5]={1,1,3,7,5}; cout << "number repeat " << endl; repeat(vec,5); }

6th May 2020, 12:37 AM
KeynerZzz
KeynerZzz - avatar
1 Antwort
6th May 2020, 2:40 AM
Dasarath Singh