To write a program which inputs 30 integers in a 1-d array and using user defined function find index number at which the maximum integer is found. the function should return the index which should be shown in a suitable variable in main and displays the value in main itself.
1
Expert's answer
2014-12-16T05:10:47-0500
// The libraries //To write a program which inputs 25 integers in a 1-d array //and copies all even integers in another array and all odd integers in third array. // #include <iostream> #include <cstdio> #include <cmath> #include <string> #include <fstream> using namespace std; int main() { const int N=30; int arr[N]; cout<<"Enter 30 number please"<<endl; int temp_number=0; int temp_number_index=0; for (int i=0;i<N;i++) { cout<<"["<<i+1<<"]"<<":"; cin>>arr[i]; if (arr[i] > temp_number ) temp_number=arr[i];temp_number_index=i; } cout<<"Maximum number in array"<<temp_number<<" index in array is: "<<temp_number_index<<endl; return 0; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment