Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

c++ program to separate unique elements of array

// C++ program to print all distinct elements in a given array
#include <bits/stdc++.h>
using namespace std;
 
void printDistinct(int arr[], int n)
{
    // Pick all elements one by one
    for (int i=0; i<n; i++)
    {
        // Check if the picked element is already printed
        int j;
        for (j=0; j<i; j++)
           if (arr[i] == arr[j])
               break;
 
        // If not printed earlier, then print it
        if (i == j)
          cout << arr[i] << " ";
    }
}
 
// Driver program to test above function
int main()
{
    int arr[] = {6, 10, 5, 4, 9, 120, 4, 6, 10};
    int n = sizeof(arr)/sizeof(arr[0]);
    printDistinct(arr, n);
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Typescript :: .htaccess Forcing scripts to display as source code 
Typescript :: angular TS2377 
Typescript :: how to import contacts from android phone to laptop 
Typescript :: gang beasts türkiye discord 
Typescript :: dynamic key 
Typescript :: dto typescript 
Typescript :: missing return type on function @typescript-eslint/explicit-function-return-type 
Typescript :: compy mongodb database with indexes 
Typescript :: nativescript routerextensions navigate 
Typescript :: typescript interface optional 
Typescript :: nativescript date input validation 
Typescript :: are flights still running 
Typescript :: webots epuck line follower code 
Typescript :: How can I create an array with a range of decimal increments in SwiftUI ? 
Typescript :: pretty print json file cmd 
Typescript :: print in a tsv file all names of files in a directory linux 
Typescript :: Defects and Defect Density of quality software 
Typescript :: choose random elements from vector without repetition and adding to another vector c++ 
Typescript :: typescript maybe type 
Typescript :: elements of programming interviews in python 
Typescript :: carousel not moving unless reload the page 
Typescript :: useHorizontalScroll react 
Typescript :: Make ngModel wait for data angular 
Typescript :: captain tsubasa episodi 
Typescript :: number of elements in circular queue 
Typescript :: passing arguments in python from command line as key value 
Typescript :: group list into sublists python 
Typescript :: input non-negative decimal in typescript 
Typescript :: typescript check if value is in enum 
Typescript :: Update multiple documents with different field value by id set. Mongoose 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =