/

/fdgdfg
Last edited on
1
2
int n = 10;
int a[n];

That isn't valid C++. Nor does it match any of the instructions you've given.
closed account (E0p9LyTq)
1) Create an integer array of size 100
int anArray[100] { 0 };

2) Create a for-loop that input N integers ( N = 8 ) into the array
1
2
3
4
5
6
const int N = 8;
for (int loop = 0; loop < N; loop++)
{
   std::cout << "Enter the number: ";
   std::cin >> anArray[loop];
}
closed account (E0p9LyTq)
3) Create another for-loop that finds the position of the element that has the smallest value in your array
1
2
3
4
5
6
7
8
9
10
int min = anArray[0];
int pos = 0;
for (int loop = 1; loop < N; loop++)
{
   if (min > anArray[loop])
   {
      min = anArray[loop];
      pos = loop;
   }
}
Last edited on
Topic archived. No new replies allowed.