KeNjICannel
19.08.2020 05:59

10. Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1. Sort the elements of arr1 such that the relative ordering of items in arr1 are the same as in arr2. Elements that don't appear in arr2 should be placed at the end of arr1 in ascending order.

можете написать это в С++
до 30 50 мин

Нажмите на рекламу ниже и сразу увидите ответ
↓
Популярные вопросы:
Ответ:
KKK11576
07.10.2020 07:16
1)
#include<iostream>
#include<cmath>  
void main() {    
char ch1, ch2;    
int vol1, vol2;          
std::cin >> ch1 >> vol1;        
std::cin >> ch2 >> vol2;                            
if abs(ch1 - ch2) <= 2) && (abs(vol1 - vol2) <= 2)) && ((ch1 != ch2) && (vol1 != vol2))) && !((abs(ch1 - ch2)==1) && (abs(vol1-vol2))==1))             std::cout << "Possible";                    
else            
std::cout << "Impossible";        
}
3)
#include<iostream> 
using namespace std; 
void main() {    
int n,m;
cin >> n,m;
cout<<n;
for(int i=n;i<=m;i++)
cout<<i+2;
}
4)

#include <iostream>
using namespace std; void main(){
int mass[2][4]   //размерность своего массива вписывай.
{
{ 1, 2, 3, 4 },  //вписывай свои числа.
{ 1, 2, 3, 4 }  
};

for (int i=0 ; i<2;++i)
{
for (int j=0 ; j<4;++j)
{
if(mass[i][j]<0)
 cout<<mass[i][j];
}
}
system("pause");
}

 
0,0(0 оценок)
Ответ:
26dura
12.07.2021 04:00
// PascalABC.NET 3.0, сборка 1128
procedure Convert(V:array of integer);
begin
  for var i:=0 to V.Length-1 do
    if V[i]>9 then V[i]:=9
    else
      if V[i]<5 then V[i]:=5
end;

procedure Develop(c:char; k:integer);
begin
  WritelnFormat('*** Массив {0} ***',c);
  var a:=ArrRandom(k,-5,15);
  Write('исходный : '); a.PrintLn(',');
  Convert(a);
  Write('результат: '); a.PrintLn(',');
end;

begin
  var m:=ReadInteger('Количество элементов в массиве A:');
  var n:=ReadInteger('Количество элементов в массиве B:');
  Develop('A',m);
  Develop('B',n)
end.

Тестовое решение:
Количество элементов в массиве A: 15
Количество элементов в массиве B: 10
*** Массив A ***
исходный : 6,5,-5,9,1,0,-3,9,13,12,-4,8,11,14,-5
результат: 6,5,5,9,5,5,5,9,9,9,5,8,9,9,5
*** Массив B ***
исходный : 5,12,12,4,7,9,7,-3,-1,-2
результат: 5,9,9,5,7,9,7,5,5,5
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота