Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

wrong output

$
0
0
#include <iostream>

using namespace std;
void swapArray(int  array1[], int  array2[],int size);

void swapArray(int array1[],int array2[], int size)
{
        int temp;
    for (int i=0;i<size;i++)
   {
    temp= array1[i];
    array1[i] = array2[i];
    array2[i] = temp;
    cout<<"array 1 elements is:"<<array1[temp]<<endl;
    cout <<"array 2 elements is:"<<array2[temp]<<endl;
}}
int main()
{
    int size=5;
    int array1[size];
    int array2[size];
    int element1,element2;

    array1[size] = element1;
    array2[size] = element2;
for (int i=0;i<size;i++)
 {cout<<"please Enter Element of The first array"<<endl;
 cin>>element1;
 cout<<"please Enter Element of The second array"<<endl;
 cin>>element2;
 swapArray (array1,array2,size);
 }


    return 0;
}



i wrote this code to swap elements in array to swap each element one by one but m not having to right output any highlights?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>