#include <iostream> #include <cstdlib> #include <ctime> int main() { using namespace std; cout << "Enter size of array: "; int N; cin >> N; int * ARR = new int[N]; srand(time(0)); int i; for (i = 0; i < N; ++i) ARR[i] = rand() % 100 + 1;
cout << "Here is an original array:\n"; for (i = 0; i < N; ++i) cout << ARR[i] << " "; cout << endl;
int temp = ARR[N - 1]; for (i = N - 1; i > 0; --i) ARR[i] = ARR[i - 1]; ARR[0] = temp;
cout << "\nHere is a new array:\n"; for (i = 0; i < N; ++i) cout << ARR[i] << " "; cout << endl;
ответ: ок я програмист со стажем
Объяснение:
user = "імя"
action = "школа"
log_message = 'Пользователь {} зашел на сайт и выполнил действие: {}'.format(
user,
action
)
print(log_message)
# Пользователь імя зашел на сайт и выполнил действие: школа
from dataclasses import dataclass
@dataclass
class Armor:
armor: float
description: str
level: int = 1
def power(self) -> float:
return self.armor * self.level
armor = Armor(5.2, "Common armor.", 2)
armor.power()
# 10.4
print(armor)
# Armor(armor=5.2, description='Common armor.', level=2)
#include <cstdlib>
#include <ctime>
int main()
{
using namespace std;
cout << "Enter size of array: ";
int N;
cin >> N;
int * ARR = new int[N];
srand(time(0));
int i;
for (i = 0; i < N; ++i)
ARR[i] = rand() % 100 + 1;
cout << "Here is an original array:\n";
for (i = 0; i < N; ++i)
cout << ARR[i] << " ";
cout << endl;
int temp = ARR[N - 1];
for (i = N - 1; i > 0; --i)
ARR[i] = ARR[i - 1];
ARR[0] = temp;
cout << "\nHere is a new array:\n";
for (i = 0; i < N; ++i)
cout << ARR[i] << " ";
cout << endl;
return 0;
}