View Single Post
  #1  
Old 13-10-2008, 10:37 PM
BSIT07-01's Avatar
BSIT07-01 BSIT07-01 is offline
Addicted to Computer


 
Join Date: Sep 2007
Location: ------------
Age: 34
Posts: 1,309
Contact Number: ---------------
Program / Discipline: BSIT
Class Roll Number: 07-01
BSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant future
Default Insert function of String in C++

Here is what I had done in class for Insert Function..
Madam Nay Kaha tha Sahi hay..
But Not Executing here..


Code:
#include <iostream>
using namespace std;


void myinsert(char ar1[], char ar2[], int pos)
{
    int n=0;
    char temp[20];

    while(pos<=20)
    {
    
        temp[n]=ar1[pos];
        ar1[pos]=ar2[n];
        pos++;
        n++;
    }
    
    for(int m=0; m<=n; m++)
    {
        ar1[pos]=temp[m];
    }

}


void main()
{
    char myarray1[5]={'1','2','3','4','5'};
    char myarray2[5]={'6','7','8','9','0'};
    int pos=2;

    char newar[20];
    newar=myinsert(myarray1,myarray2,pos);

}

Reply With Quote