For that kind of problem you must compile using -lstdc++, like this :
gcc swap.cpp -lstdc++


Cheers, 
neo_krept.

Robert Ryan <[EMAIL PROTECTED]> wrote:                             I did a swap 
problem and got stuck at the end
 
 #include <stdio.h>
    
   void swap(char*, char*);
    
   void order_chars(char [], int);
    
   int main()
    
   {
    
           char g[3], a, z;
    
           a = 'A';
    
           z = 'Z';
    
           printf("Enter three characters:  \n");
    
           scanf("%s", &g);
    
           order_chars(g, 3);
    
           if(g[0] < a  || g[3] > z) {
    
                   printf("Please enter in capital characters\n");
    
           } else {
    
                   printf("%s\n", g);
    
           }
    
   }
    
    
    
           void order_chars(char a[], int n)
    
           {
    
                   int i, j;
    
                   for(i=0; i<n-1; ++i)
    
                           for(j=n; i<j; --j)
    
                                                                       if 
(a[i-1] > a[i])
    
                                           swap(&a[i-1], &a[i]);
    
           }
    
    
    
           void swap(char *a, char*b)
    
           {
    
                   char temp;
    
                   temp = *a;
    
                   *a = *b;
    
                   *b = temp;
    
           }
    
    
    
    
    
   [EMAIL PROTECTED] ~]$ vi swap.cpp
    
   [EMAIL PROTECTED] ~]$ gcc swap.cpp
    
   /tmp/ccW9b9oi.o(.eh_frame+0x11): undefined reference to
    `__gxx_personality_v0'
    
   collect2: ld returned 1 exit status
   
        
 ---------------------------------
 Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.
 
 [Non-text portions of this message have been removed]
 
 
     
                                       

       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.

[Non-text portions of this message have been removed]

Reply via email to