#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;
#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;
}
begin
writeln('Дано уравнение вида ax^2+bx+c=0');
Writeln ('Укажи переменную "a"');
readln(a);
Writeln ('Укажи переменную "b"');
readln(b);
Writeln ('Укажи переменную "c"');
readln(c);
if a = 0
then writeln('Не квадратное уравнение!')
else begin
d:= sqr(b)-4*a*c;
if d < 0 then writeln('Нет корней')
else begin
x1:= (-b+sqrt(d))/2*a;
x2:= (-b-sqrt(d))/2*a;
writeln ('X1 =',x1,' X2 =',x2);
end;
end;
end.