#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
int main() {
vector<int> a;
int B;
cin >> B;
srand(1);
for(int i = 0; i<100; ++i) {
a.push_back(rand());
cout << a[i] << " ";
a[i]+=B;
}
cout << endl;
for(int i = 0; i<a.size(); ++i) {
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
int main() {
vector<int> a;
int B;
cin >> B;
srand(1);
for(int i = 0; i<100; ++i) {
a.push_back(rand());
cout << a[i] << " ";
a[i]+=B;
}
cout << endl;
for(int i = 0; i<a.size(); ++i) {
cout << a[i] << " ";
}
}