BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan

BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan (http://bzupages.com/)
-   Object Oriented Programming (http://bzupages.com/35-object-oriented-programming/)
-   -   Copy elements of Two arrays to another ONE in C++ (http://bzupages.com/f35/copy-elements-two-arrays-another-one-c-990/)

BSIT07-01 13-10-2008 10:11 PM

Copy elements of Two arrays to another ONE in C++
 
Code:


#include
using namespace
std;

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

  for(int i=0;i<=n;i++)
    {
      if(i<=5)
        {
            myarray3[i]=myarray1[i];
        }
        else
        {
            myarray3[i]=myarray2[i-5];
        }
    }

    cout<// shows that myarray3 has Got values from other arrays on it's 9 index

}


Danish Hussain 13-10-2008 11:48 PM

Re: Copy elements of Two arrays to another ONE
 
shukriya shukriya..........:bounce2:

BSIT07-01 14-10-2008 12:44 AM

Re: Copy elements of Two arrays to another ONE in C++
 
Iss main Coloring ki hay .., Is liay Thanx kaha hay?
Waisay Yeh Sahi Execute ho jata hay :)

.BZU. 14-10-2008 01:22 AM

Re: Copy elements of Two arrays to another ONE in C++
 
1 Attachment(s)
Whats about the 0 indexed element of second array i.e. 6 not showing... Ah..:00009136:
By the way function is write...
Mam was satisfied... LOL:afriends2:
Code:

#include
using namespace std;

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

    for(int i=0;i<=n;i++)
    {
        if(i<=5)
        {
            myarray3[i]=myarray1[i];
        }
        else
        {
            myarray3[i]=myarray2[i-5];
        }
    }

for (int j=0;j<=9;j++)
    cout< }


BSIT07-01 14-10-2008 01:30 AM

Re: Copy elements of Two arrays to another ONE in C++
 
Mam nay konsa execute kar kay check karna hay :bounce2:


All times are GMT +5. The time now is 08:29 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.