in C++, Write a for loop to populate array userGuesses with NUM_GUESSES integers. Read integers using cin. Ex: If NUM_GUESSES is 3 and user enters 9 5 2, then userGuesses is {9, 5, 2}. #include using namespace std; int main() { const int NUM_GUESSES = 3; int userGuesses[NUM_GUESSES]; int i = 0; // student code here for (i = 0; i < NUM_GUESSES; ++i) { cout << userGuesses[i] << " "; } return 0; }

Answers

Answer 1

Here's a for loop that populates an array in C++ with NUM_GUESSES integers:```
#include
using namespace std;
int main() {
 const int NUM_GUESSES = 3;
 int userGuesses[NUM_GUESSES];
 int i = 0;
 for (i = 0; i < NUM_GUESSES; ++i)

{
   cin >> userGuesses[i];
 }
 for (i = 0; i < NUM_GUESSES; ++i)

{
   cout << userGuesses[i] << " ";
 }
 return 0;
}
```This program will ask the user to enter three integers and store them in the array `userGuesses`. The `for` loop runs `NUM_GUESSES` times (in this case, 3 times), and each time it prompts the user to enter an integer using `cin`, and stores it in the array at the current index (`userGuesses[i]`). Finally, it loops through the array again and prints out each integer that was entered by the user, separated by spaces.The output will look like this if the user enters 9, 5, and 2:```952```

To know about integers visit:

https://brainly.com/question/15276410

#SPJ11


Related Questions

Other Questions
How was England perceived by the rest of the world in the late 19th century, during the height of imperialism?a. As a benevolent and respectful colonial powerb. As an oppressive and exploitative empirec. As an isolationist nation avoiding foreign affairsd. As a neutral mediator in international conflicts Analyze the allusions below:1) "I wish my sun may never set. but burn within the cancer ofmy glowing breast"2) "return, return, sweet sol, from capricorn"3) "whom whilst i joyed, nor storms, nor f Franklin Corporation has an opportunity to purchase bonds at a rate of 11%. They are in the 34% tax bracket. What is the after tax yield on these bonds?a) 5.93%b) 9.62%c) 3.74d) 11%e) 7.26% the carpet page of which manuscript is a combination of christian imagery and the animal-interlace style? The following Information is for the fictitious nation Alpha: Working-age population = 1.2 million Labor force = 900,000 Number Employed = 864,000 Instructions: Enter your responses as percent values. a. The unemployment rate for Alpha Is| b. The labor force participation rate for Alpha Is % Question 1 Calculate the amount of radiation emitted by a blackbody with a temperature of 353 K. Round to the nearest whole number (e.g., no decimals) and input a number only, the next question asks a Complete Study Questions: Cite sources in accordance with APA, including in-text citations and references. Many celebrities in the 1960s and 1970s, like Pete Seeger, used their fame to promote environmental causes. What celebrities can you think of who are active today on environmental issues and what do they promote? What is the significance of the Montreal Protocol in the history of the sustainability movement? What are ecosystems services? Provide several examples of ecosystems services that benefit us. Compare and contrast the Millennium Development Goals and the Sustainable Development Goals. Why is stakeholder engagement important in sustainability projects? Do you think the development of waste to energy power plants are good or bad sustainability initiatives? Indicate whether the following statements are "True" or "False" regarding characteristics of ad valorem taxes on realty. A. Some jurisdictions extend immunity from tax for a specified period of time (a tax holiday) to new or relocated businesses. B. Some states partially exempt the homestead, or personal residence, portion of property from taxation. C. Lower taxes may apply to a residence owned by a taxpayer aged 65 or younger. D. Property owned by the Federal government is exempt from this tax. Question 3Discuss the relative merits of the compensation test and social welfare function approaches to social cost benefit analysis (SCBA) as a means of making public investment decisions. Your answer should address both theoretical and practical considerations. Empirically, in recent decades, the evidence regarding growth is most accurately described by which of the following?a. divergence has occurred among developed countries divergence has occurred among developing countriesb. divergence has occurred between the richest and poorest nations tc. The richest and poorest nations have, on average, growing at roughly equal rates, neither converging nor divergingd. convergence has taken place between the richest and poorest nations What is the network effect (i.e., networkexternalities) in Gogoro's case? Are Gogoro's network externalitiesconstrained within a country (i.e., within-country network) orunlimited by countries (i.e ay corporation's capital structure at december 31, year 1, was as follows: shares issued and outstanding common stock 200,000 nonconvertible preferred stock 50,000on october 1, year 2, fay issued a 10% stock dividend on its common stock, and paid $100,000 cash dividends on the preferred stock. net income for the year ended december 31, year 2, was $960,000. fay's year 2 earnings per common share should be a $3.91 b $4.10 c $4.36 d $4.68 show answer characterize the likely shape of a histogram of the distribution of scores on a midterm exam in a graduate statistics course. What can happen when a family puts too much pressure on members to behave or live in a certain way? O A. O B. O C. O D. It creates emotional stability and a harmonious vibe in the family. Family members will always choose to leave the family and never return. It creates emotional divides and harms the overall cohesiveness of the group. It allows everyone to feel important and like an active participant of the family. The A string on a violin has a fundamental frequency of 440 Hz . The length of the vibrating portion is 32 cm , and it has a mass of 0.40 g .Under what tension must the string be placed? Express your answer using two significant figures. FT = nothing Moving to another question will save this response. Question 7 Which of the following characteristics of agility relates to agile organizations pivoting as needed to take advantage of opportunities as they sense them? O focused O fast O flexible O futuristic You plan to spend the next four summers vacationing abroad. The first summer trip, which isexactly one year away, will cost you $22000, the second-$27 500, the third- $33000, and thefourth- $35000. You want to save for these vacations. How much should you deposit in youraccount today so that you will have exactly enough to finance all the trips? The account paysinterest at 6%, compounding semi-annually. Explain how to find the minimum key stored in a B-tree and how to find the prede- cessor of a given key stored in a B-tree. Evaluate the impact of the five forces that drive competition in the fast-food industry. In other words, using Michael E. Porter's Five-Forces Model (Chapter 4, pp. 100-109), assess the relative strength of each force within the fast-food industry. 1. Consider the economy of South Korea. Discuss how the historical, geographic, political,cultural or ethnic background and/or natural resources endowment shaped this countryseconomic development. (It is not necessary to cover all of these mentioned factors.)2. What are the well-understood determinants of South Koreas economic miracle between1963 and 1997?