#include <iostream>
using namespace std;
int main() {
int mx;
int mx_num;
int t{};
std::cout <<"Enter desired max of the array: ";
std::cin >> mx;
int *array = new int[mx];
cout << "Enter your numbers: " << endl;
int i{};
while (i < mx)
{
cin >> array[i];
if(t < 1)
{
mx_num = array[i];
t++;
}
i++;
}
for(i = 0; i < mx; i++)
{
cout << array[i] << "\t";
}
for(i = 0; i < mx; i++)
{
if(array[i] > mx_num)
{
mx_num = array[i];
}
}
cout << endl;
cout << "Максимальное число последовательности: " << mx_num << endl;
cout << endl;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter