What is wrong with the following loop? vector v(10); int i; for (i = 1; i <= 10; i++) v[i] = i * i;
Added by Eduardo T.
Step 1
Step 1: The loop starts with i = 1, but the vector v is 0-indexed, so the first element should be accessed with v[0]. Show more…
Show all steps
Your feedback will help us improve your experience
Monica Miller and 74 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Explain what is wrong with the statement. A vector $\vec{v}$ in the plane whose $\vec{i}$ -component is 0.5 has smaller magnitude than the vector $\vec{w}=2 \vec{i}.$
A Fundamental Tool: Vectors
Vectors in General
Explain what is wrong with the statement. $$\text { If }\|\vec{u}\|=1 \text { and }\|\vec{v}\|>0, \text { then }\|\vec{u}+\vec{v}\| \geq 1$$
Displacement Vectors
Write the given vector in terms of i and j. u = (-10, 8) u = ?
Craig W.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD