Program to illustrate string concatination using strcat()

#include<iostream.h>
#include<conio.h>
#include<string.h>
    float ADD (float, float);
    int   ADD (int, int);
    char * ADD (char *, char *);
    char S1 [50] , S2 [50], S3 [100];
    void main ( )
    {     int n = ADD (4, 6);
        float d = ADD (4.7, 8.4)
        ;
        cout << " Add (4, 6) = " << n ;
        cout << " Add (4.7, 8.4) = " << d << " \n" ;
        strcpy (S1, " Object oriented ");
        strcpy (S2, " Database model ");
        strcpy (S3, ADD (S1, S2));
        cout << S1 << " + " << S2 << " = " << S3 ;
        getch( ) ;
    }
    float ADD (float a, float b)
    {
        return (a + b);
    }
        int ADD (int a, int b)
        {
            return (a + b);
        }
        char * ADD (char* S1, char* S2)
        {
            strcat (S1, S2) ;
            return S1;
        }

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|