vector merging
What did I do wrong here I want to merge 2 vectors to 1 vector, and order them from the smallest number to the biggest.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#include<iostream>
using namespace std;
int main()
{
int a[3],b[3],c[6],i,j,g;
cout<<"fut a\n";
for(i=0;i<3;i++)
cin>>a[i];
cout<<"fut b\n";
for(i=0;i<3;i++)
cin>>b[i];
for(i=0;i<3;i++)
c[i]=a[i];
for(i=0;i<3;i++)
c[i+3]=b[i];
for(i=0;i<6;i++)
{
for(j=i+1;j<6;j++)
{
if(c[i]<c[j])
{
g=c[i];
c[i]=c[j];
c[j]=g;
}
}
}
for(i=0;i<6;i++)
cout<<endl<<a[i]<<" ";
cout<<endl;
return 0;
}
|
Lines 21 and 30.
thank you.
Topic archived. No new replies allowed.