#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
#include <random>
#include <ctime>
#include <functional>
using namespace std;
int main() {
int n;
cin>>n;
vector<int>v(n);
mt19937 gen(time(nullptr));
uniform_int_distribution<>dist(0,20);
generate(v.begin(),v.end(),bind(dist,gen));
copy(v.cbegin(),v.cend(),ostream_iterator<int>(cout," "));
cout<<endl;
rotate(v.begin(),v.begin()+1,v.end());
}
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#define size 15
int mass[size];
void randArray()
{
printf("An array of the fiveteen random elements:\n");
for (int i=0; i<size; i++)
mass[i] = 1 + rand() % 100;
printf("%d\t", mass[i]);
int findElements(unsigned count)
count = 0;
if (abs(mass[i]) % 10 == 6) count++;
return count;
int main()
unsigned count = 0;
srand(time(NULL));
randArray();
printf("\nNumber of elements which ending on six: %d", findElements(count));
return 0;
#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
#include <random>
#include <ctime>
#include <functional>
using namespace std;
int main() {
int n;
cin>>n;
vector<int>v(n);
mt19937 gen(time(nullptr));
uniform_int_distribution<>dist(0,20);
generate(v.begin(),v.end(),bind(dist,gen));
copy(v.cbegin(),v.cend(),ostream_iterator<int>(cout," "));
cout<<endl;
rotate(v.begin(),v.begin()+1,v.end());
copy(v.cbegin(),v.cend(),ostream_iterator<int>(cout," "));
}
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#define size 15
int mass[size];
void randArray()
{
printf("An array of the fiveteen random elements:\n");
for (int i=0; i<size; i++)
{
mass[i] = 1 + rand() % 100;
printf("%d\t", mass[i]);
}
}
int findElements(unsigned count)
{
count = 0;
for (int i=0; i<size; i++)
{
if (abs(mass[i]) % 10 == 6) count++;
}
return count;
}
int main()
{
unsigned count = 0;
srand(time(NULL));
randArray();
printf("\nNumber of elements which ending on six: %d", findElements(count));
return 0;
}