Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. To sort an array of integer's with recursive functions ?

To sort an array of integer's with recursive functions ?

Scheduled Pinned Locked Moved Managed C++/CLI
data-structuresquestion
3 Posts 2 Posters 11 Views 1 Watching
  • 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.
  • T Offline
    T Offline
    Tarun Jha
    wrote on last edited by
    #1

    i have tried it but it doen't work. It would be great if you could point out my mistake and better if correct it.

    #include #include int inc_order(int num[], int count, int i);
    int compare(int hole, int value, int num[]);

    int main(){
    int num[50], n, count, j, i=0;

    printf("Number of integers: \\t");
    scanf("%d", &count);
    
    printf("\\nEnter your integers: \\n");
    
    for(n=0; nvalue){
    	num\[hole\] = num\[hole-1\];
    	hole--;
    }
    
    compare(hole, value, num);
    

    }

    P 1 Reply Last reply
    0
    • T Tarun Jha

      i have tried it but it doen't work. It would be great if you could point out my mistake and better if correct it.

      #include #include int inc_order(int num[], int count, int i);
      int compare(int hole, int value, int num[]);

      int main(){
      int num[50], n, count, j, i=0;

      printf("Number of integers: \\t");
      scanf("%d", &count);
      
      printf("\\nEnter your integers: \\n");
      
      for(n=0; nvalue){
      	num\[hole\] = num\[hole-1\];
      	hole--;
      }
      
      compare(hole, value, num);
      

      }

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      That is not a proper task for recursion.

      T 1 Reply Last reply
      0
      • P PIEBALDconsult

        That is not a proper task for recursion.

        T Offline
        T Offline
        Tarun Jha
        wrote on last edited by
        #3

        solced it

        #include
        #include

        int largest(int num[], int count, int i, int max);
        int i=0;

        int main(){
        int num[50], n, count, max, l, j, l_2;

        printf("Number of integers: \\t");
        scanf("%d", &count);
        
        printf("\\nEnter your integers: \\n");
        
        for(n=0; n
        
        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups