ok actually its 2 questions...
first..
how do i get a program to fill an array with a certain number imputed by the user?
second..
how can i make a program divide the numbers in 1 array with the numbers in another?
thanks for the help
Printable View
ok actually its 2 questions...
first..
how do i get a program to fill an array with a certain number imputed by the user?
second..
how can i make a program divide the numbers in 1 array with the numbers in another?
thanks for the help
1)
-Get input from the user any way you like. getch() or whatever.
-Then just use a for loop.
2)Code:for (int i = 0; i < MAX_ARRAY_ELEMENTS; i ++)
array[i] = input_from_user;
Simular to the first.
Code:for (int i = 0; i < MAX_ARRAY_ELEMENTS; i ++)
{
if (array2[i] != 0) //we dont want division by zero
Result[i] = array1[i] / array2[i];
else
Result[i] = 0;
}