1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
IrinaK [193]
3 years ago
9

Write a for loop to populate array userGuesses with NUM_GUESSES integers. Read integers using cin. Ex: If NUM_GUESSES is 3 and u

ser enters 9 5 2, then userGuesses is {9, 5, 2}. for C++
Computers and Technology
1 answer:
vlabodo [156]3 years ago
6 0

Answer:

Follows are the code to this question:

#include <iostream>//defining header file

using namespace std;

int main() //defining main method

{

const int NUM_GUESSES = 3;//defining an integer constant variable NUM_GUESSES

int userGuesses[NUM_GUESSES];//defining an array userGuesses

int i = 0;//defining integer variable i

for(i=0;i<NUM_GUESSES;i++)//defining for loop for input value

{

cin>>userGuesses[i];//input array from the user end  

}

for (i = 0; i < NUM_GUESSES; ++i)//defining for loop fore print value  

{

cout <<userGuesses[i] << " ";//print array value with a space

}

return 0;

}

Output:

9

5

2

9 5 2  

Explanation:

In the above-given program, an integer constant variable NUM_GUESSES is defined that holds an integer value, in the next step, an integer array "userGuesses" is defined, which holds NUM_GUESSES value.

In the next step, two for loop is defined, in the first loop, it is used for an input value, and in the second loop, it prints the array value.    

You might be interested in
Give a recursive algorithm for finding the sum of the<br> first n odd positive integers.
Andrei [34K]
I'm writing that in some sort of pseudocode; if you don't understand it, feel free to ask for more details in the comments.

function sumOdd(n)
    if n==1 then
        return 1
    end if
    return (sumOdd(n-1))+(n*2-1)
end function
3 0
3 years ago
____ allows someone browsing the internet to click on words or phrases, enter his or her phone number, and continue browsing
Sphinxa [80]
It is the internet callback technology that allows someone browsing the internet to click on words or phrases, enter his or her phone number, and continue browsing. It is a technology that enable one to browse the Internet to cue on a certain website to have a representative call a certain number.<span />
6 0
3 years ago
Read 2 more answers
Juhfvehrfwhedfhwkefhkujhiuyuiyuiyiyh
maw [93]

Answer:

blah

blah

blah..⁉️

Explanation:

juhfvehrfwhedfhwkefhkujhiuyuiyuiyiyh

⁉️

8 0
3 years ago
Which of the following could be true of two diffrent speicies that have competitieve realtionship in the same ecosytem?
chubhunter [2.5K]

they both an enemy that is the same but they also have a same niche so the have the same niche

6 0
3 years ago
Which one of the secondary storage types below would be best if you wanted to edit files and re-save them to secondary storage?
jenyasd209 [6]
USB drive
the cloud
google docs
google drive
7 0
3 years ago
Other questions:
  • Trish uas bought a new computer, which she plans to start working on aftwr a week. Since Trish has not used computers in the pas
    13·1 answer
  • Which of the following might be ways to reduce cognitive overload? Select all that apply
    5·1 answer
  • What are 5 actions that you can do to take care of your camera
    14·2 answers
  • Document creation is a key business function because:
    6·2 answers
  • Amelia has selected the chart in her PowerPoint and needs to change the chart type. Which one of the Chart Tools tabs would she
    15·1 answer
  • Nascar has inserted an image into his document but needs the image to appear on its own line Which option should he choose?
    12·2 answers
  • PLEASE HELP!!! WILLGIVE BRAINLIEST!!!
    11·2 answers
  • Why do guys get jealous when u hangout with another guy that's not them
    6·2 answers
  • What does it mean that the right mouse button is context-sensitive?
    15·1 answer
  • How to fix this? Zoom it in to see it better
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!