如何由数组a和数组b得到数组c?
如何由数组a和数组b得到数组c?int[]a={10,20,30};int[]b={10,20,40,50,60};int[]c={30,40,50,60};谁给写一下啊...
如何由数组a和数组b得到数组c?
int [] a = {10,20,30};
int [] b ={10,20,40,50,60};
int [] c = {30,40,50,60};
谁给写一下啊??
java语言 谢谢 展开
int [] a = {10,20,30};
int [] b ={10,20,40,50,60};
int [] c = {30,40,50,60};
谁给写一下啊??
java语言 谢谢 展开
1个回答
展开全部
#include <iostream>
using namespace std;
#define my_first (3)
#define my_second (4)
#define my_third (5)
void main()
{
int a[my_first] = {10,20,30};
int b[my_second]= {10,20,40,50,60};
int c[my_third]={0,0,0,0};
int i=0;
while(i<my_second)
{
for(int k=0;k<my_first;k++)
{
if (k<(my_first-1))
continue;
c[i++] = a[k];
}
for(int k=0;k<my_third;k++)
{
if (k<(my_first-1))
continue;
c[i++] = b[k];
}
}
i=0;
while(i<my_second)
{
cout<<c[i++]<<endl;
}
system("pause");
}
using namespace std;
#define my_first (3)
#define my_second (4)
#define my_third (5)
void main()
{
int a[my_first] = {10,20,30};
int b[my_second]= {10,20,40,50,60};
int c[my_third]={0,0,0,0};
int i=0;
while(i<my_second)
{
for(int k=0;k<my_first;k++)
{
if (k<(my_first-1))
continue;
c[i++] = a[k];
}
for(int k=0;k<my_third;k++)
{
if (k<(my_first-1))
continue;
c[i++] = b[k];
}
}
i=0;
while(i<my_second)
{
cout<<c[i++]<<endl;
}
system("pause");
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询