Предмет: Информатика,
автор: InkoGniToSAnonN
Информатика. 9 класс: дан массив L, содержащий 40 элементов в интервале от 10 до 50. заменить первый и последний элементы массива.
Помогите, пожалуйста! :)
Ответы
Автор ответа:
0
C++
#include <iostream>
#include <ctime>
using namespace std;
void main()
{
srand(time(0));
int L[40];
for(int i=0;i<40;i++)
{
L[i]=10+rand()%50;
cout<<L[i]<<" ";
}
cout<<endl;
int newf=0;newl=0;
cout<<"Input new first value: "; cin>>newf;
cout<<"Input new last value: "; cin>>newl;
L[0]=newf; L[39] = newl;
for(int i=0;i<40;i++)
cout<<L[i]<<" ";
cout<<endl;
}
#include <iostream>
#include <ctime>
using namespace std;
void main()
{
srand(time(0));
int L[40];
for(int i=0;i<40;i++)
{
L[i]=10+rand()%50;
cout<<L[i]<<" ";
}
cout<<endl;
int newf=0;newl=0;
cout<<"Input new first value: "; cin>>newf;
cout<<"Input new last value: "; cin>>newl;
L[0]=newf; L[39] = newl;
for(int i=0;i<40;i++)
cout<<L[i]<<" ";
cout<<endl;
}
Похожие вопросы
Предмет: Музыка,
автор: iiz07
Предмет: Українська мова,
автор: Аноним
Предмет: История,
автор: erkenovatomiris77
Предмет: Математика,
автор: minecraftsteveigor
Предмет: Алгебра,
автор: generallegion