Wap to input 10 numbers in an array and print the array

hdeezie80

Honorable
Jul 18, 2012
14
0
10,560
0
In c++?

void numInput(int array, int index);
{
for ( i = 0; i < index; i++)
{
int temp = 0;
cout << "Enter number for index " << i << ": ";
cin >> temp;
array = temp;
}
}

If its just copying an array thats even easier

void copyArray(int array, int array2, index)
{
for (i = 0 ; i < index; i++)
array = array2;
}

you have to declare an array first like:

array[10] = 0;
numInput(array, 10);
for (i = 0; i < 10; i ++)
cout << array;


if its python

def numInput (max)
l = []
for i in range (0, max, 1) :
temp = raw_input("Enter number for index: ")
l.append(temp)
return l

list = numInput(10)
print list

pretty much the same for java, javascript, etc.

this is pretty easy stuff though, if your struggling with this you should definitely study or read because your going to have a really tough time with classes, exceptions, lambda expressions, etc later on
 
Thread starter Similar threads Forum Replies Date
Y Apps General Discussion 1
A Apps General Discussion 3
S Apps General Discussion 2
R Apps General Discussion 3
I Apps General Discussion 2
E Apps General Discussion 1
S Apps General Discussion 1
S Apps General Discussion 3
F Apps General Discussion 3
Rainfire Apps General Discussion 3
A Apps General Discussion 6
P Apps General Discussion 5
FlamingFox Apps General Discussion 1
B Apps General Discussion 3
P Apps General Discussion 3
J Apps General Discussion 1
M Apps General Discussion 1
M Apps General Discussion 6
shiftyape Apps General Discussion 3
M Apps General Discussion 2
Similar threads
Write a program to calculate commission for the input valu of sales amount
Getting keyboard input through microfone
I don't have steam but I have origin and I've downloaded a few games (i had a disc input on my old computer) on my first compu
Installed Equalizer APO and now discord wont detect microphone input
1. Write a program that outputs the greatest common divisor of two positive integers. For example, if you input two positive
Gmail response input problems...
How to take user input of one form and assign it to a variable in another form in java?
How to compare user input in a jTextfield with data in the database? (im using java & php)
Having input trouble with a personal Java project
How do I make a yes or no question with different outcomes depending on input?
3. Write a C# application that asks the user to input ‘A’ and ‘B’ and prints the sum of squares of all even numbers be
Asus Tweaker is causing my monitor to display "input not supported"
[Survey] Wanting Input on Media Players
Batch file to open app, and input commands.
input the roman numerals from text file and convert it into arabic and again write it into text file in java
I need a program that takes HTML file as input and convert it to hypertree of webOQL type. You may consider a simple HTML file
How can I get Speedfan to work constantly without any user input?
Write a program that reads 3 integers as input and prints the second largest of these three numbers. Example: Input: 3 4 5 Out
c++ how to advance if dont get input
a certain program input ten numbers via keyboard and add up all the numbers less than zero

ASK THE COMMUNITY