Arrays in loops

Asked

Viewed 106 times

-5

I could not resolve the following doubt:

Fill in the blanks to print all elements of a array arr containing 3 elements:

for(int x=0; x<___; x++){______<<______[x]<<endl;}
  • 3

    Hi @français. There is no problem you present a problem that may be of studies, but presenting a statement without an apparent research effort waiting for a solution is not the focus of this site. What is the doubt?

  • I could not solve the whole question. If you put 3 in the first dash , in the second you put the word Cout, but what you put in the third dash?

  • The name of the array, @français. arr, in the case

  • @jbueno, thank you very much, hugs.

1 answer

1


By the comment you know how to fill the first two. If you want to print the array arr, should print what? The variable containing the array, right? More specifically you should print an element of array through your index. This index is already in the code ([x]). So all that’s missing is the variable name.

If someone asks you what color Napoleon’s white horse is, can you answer? Then the answer is already in the question. Do I need to write?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.