#include <stdio.h>#include <stdlib.h> #include <conio.h>#include <iostream>using namespace std;
int main(int argc, char* argv[]){int m;int arr[10];cout << "input elements " << endl;for ( int i= 0; i < 10; i++ ) cin >> arr[i]; cout << "input m " << endl;cin >> m; cout << "arr = {";for ( int j = 0;j < 10; j++ )cout << arr[j] << " ";int sum;for ( int k = 0; k < 10; k++ )if (arr[k]*arr[k+1]<=m) {sum=arr[k]+arr[k+1];break;}cout << "" << endl;cout << "Summa " << " ";cout << sum << endl;;system("pause");return 0;}
#include <iostream>#include <algorithm>#include <numeric>#include <iterator>#include <functional>#include <cstdlib>using namespace std;const int SIZE = 20;int arr[SIZE] = { -1, 1, 5, 2, -4, 0, 7, -2, 5, -9, 3,6,-9,0,-4,4,6,2,13,5 };void Massiv(){cout << "new Array:" << std::endl;copy(arr, arr + SIZE, std::ostream_iterator<int>(std::cout, " "));cout << std::endl;
int memory= arr[0];for (int k=0;k<SIZE-1;k++)arr [k]=arr[k+1];arr[SIZE-1]=memory;cout << "new Array:" << std::endl;copy(arr, arr + SIZE, std::ostream_iterator<int>(std::cout, " "));cout << std::endl;}
int main(){Massiv();system("pause");return 0;}
Второе не понял задания
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{int m;int arr[10];
cout << "input elements " << endl;
for ( int i= 0; i < 10; i++ )
cin >> arr[i];
cout << "input m " << endl;
cin >> m;
cout << "arr = {";
for ( int j = 0;j < 10; j++ )
cout << arr[j] << " ";
int sum;
for ( int k = 0; k < 10; k++ )
if (arr[k]*arr[k+1]<=m) {
sum=arr[k]+arr[k+1];break;
}
cout << "" << endl;
cout << "Summa " << " ";
cout << sum << endl;;
system("pause");
return 0;}
#include <iostream>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <cstdlib>
using namespace std;
const int SIZE = 20;
int arr[SIZE] = { -1, 1, 5, 2, -4, 0, 7, -2, 5, -9, 3,6,-9,0,-4,4,6,2,13,5 };
void Massiv()
{
cout << "new Array:" << std::endl;
copy(arr, arr + SIZE, std::ostream_iterator<int>(std::cout, " "));
cout << std::endl;
int memory= arr[0];
for (int k=0;k<SIZE-1;k++)
arr [k]=arr[k+1];
arr[SIZE-1]=memory;
cout << "new Array:" << std::endl;
copy(arr, arr + SIZE, std::ostream_iterator<int>(std::cout, " "));
cout << std::endl;}
int main()
{
Massiv();
system("pause");
return 0;
}
Второе не понял задания