Salut

j'ai un probleme avec ce projet consiste a inserer un élement dans un tableau trié et je vois pas qui ce que c'est si vous voulez m'aidé ,voici le code .

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
 
 
void inserer(int elt,int t[20],int n)
{
     int i=0,j;
             while( i<n && t[i]<elt)  
             {
 
              i++;
             } 
                  n++;
                 j=n;
             while  (i<j)        
                   {
                                t[j]=t[j-1];       
                                } 
                                t[i-1]=elt;  
 
     }
 
 
 
     void afficher(int t[20],int n)
     {
          int j;
         for (j = 0; j < n; j++) {
	        		printf(" %d\t",t[j]);
                    }  
      }
      void saisie(int n, int t[20])
      {
           int j;
 
           for (j = 0; j < n; j++)
            {
	        		printf("entrer d'elemt [%d]\t ",j);
	        		scanf(" %d",&t[j]);    
	        }
       }
int main()
{
 
     printf("==========================================================================\n\n\n");
     printf(" ==========================================================================\n\n\n");
     	printf("\t\tProgramme d'insertion d'un element dans un tableau trie\n\n\n");
 
 
    printf(" ==========================================================================\n\n\n");
     printf(" ==========================================================================\n\n\n");
 
    	printf("saisie du tableau\n");
 
    int j,n,t[20],elt1,elt;
 
  	printf("entrer n ");
  	scanf(" %d ",&n);
  	printf("saisie du tableau\n");
 saisie(n,t);
 
 
 
afficher(t,n);
	     printf("entrer l'elemt A INSERER  ");
	       	scanf(" %d",&elt); 
  inserer(elt, t, n);
 afficher(t,n);
 
   return 0;
}
merci d'avence