Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can i compare each element of an array to all the elements of another array?

How can i compare each element of an array to all the elements of another array?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 273 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    ioanna
    wrote on 11 Mar 2020, 14:08 last edited by
    #1
    int a[] = {pr1,pr2,pr3,pr4,pr5,pr6,pr7,pr8,pr9,pr10};
        int b[] = {spr1,spr2,spr3,spr4,spr5,spr6,spr7,spr8,spr9,spr10};
    

    if (first element of a[] <= all elements of b[]){
    // mark the element used in b[] and store the value used in int c

    }

    It will do the same from first element of a[] to the last element. How can i achieve this? Thank you

    J 1 Reply Last reply 12 Mar 2020, 13:49
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 11 Mar 2020, 14:42 last edited by
      #2

      We're a Qt forum, not a C beginner forum... please at least post code where you tried to do your task. We're not here to teach you C.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      5
      • I ioanna
        11 Mar 2020, 14:08
        int a[] = {pr1,pr2,pr3,pr4,pr5,pr6,pr7,pr8,pr9,pr10};
            int b[] = {spr1,spr2,spr3,spr4,spr5,spr6,spr7,spr8,spr9,spr10};
        

        if (first element of a[] <= all elements of b[]){
        // mark the element used in b[] and store the value used in int c

        }

        It will do the same from first element of a[] to the last element. How can i achieve this? Thank you

        J Online
        J Online
        jsulm
        Lifetime Qt Champion
        wrote on 12 Mar 2020, 13:49 last edited by
        #3

        @ioanna For such questions better use https://forum.qt.io/category/34/c-gurus as your question does not have anything to do with Qt.
        Back to your question: this is actually quite simple to do. What did you try and what does not work?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        4

        1/3

        11 Mar 2020, 14:08

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved