Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void arr(int *M,int N,int ind) {
- int max = M[0];
- for (int i = 0;i < N;i++) {
- if (max < M[i]) {
- max = M[i];
- ind = i;
- }
- }
- cout << "Индекс= " << ind << endl;
- }
- int main() {
- setlocale(LC_ALL, "Ru");
- int N,ind=0;
- cout<< "Введите размер массива " <<endl;
- cin>>N;
- int *M = new int[N];
- for (int i = 0;i<N;i++) {
- M[i] = rand() % 100;
- cout <<M[i]<<" ";
- }
- cout << endl;
- arr(M, N,ind);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement