+ 2
Hello new here... How can I take the users input, put it in an array, then show the array?
i use cin to take input, and cout to show the array. My problem is how do I put the input inside the array? thanks
4 Réponses
+ 4
int tab[10];
int var=0;
for ( int i = 0; i < 10; ++i)
{
cin >> var;
tab[i] = var;
}
+ 2
int tab[10];
then you do for loop with for example: "i" as iteration variable, and inside you write:
cin >> variable;
tab[i] = variable;
+ 2
can you please give a more detailed example please? thanks
+ 2
Woah alright it worked thanks alot man