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
fgiga [73]
1 year ago
9

write a for loop to populate array userguesses with num guesses integers. read integers using scanf. ex: if num guesses is 3 and

user enters 9 5 2, then userguesses is {9, 5, 2}.
Computers and Technology
1 answer:
snow_lady [41]1 year ago
3 0

 #include <iostream>

 

  #include <vector>

 

  using namespace std;

 

 

  int main() {

   const int NUM_GUESSES = 3;

   vector<int> userGuesses(NUM_GUESSES);

   unsigned int i;

    /* Your solution goes here  */

   for (i = 0; i < userGuesses.size(); ++i) {

      cout << "Enter number " << i << ": ";

      cin >> userGuesses.at(i);

    }

 

   for (i = 0; i < userGuesses.size(); ++i) {

 

       cout << userGuesses.at(i) << " ";

 

    }

 

    return 0;

 

 }

While a given condition is true, an action is repeated in a for loop. When the condition ultimately evaluates to false, the action is stopped from being repeated. The for loop in JavaScript resembles the for loop in C and Java fairly closely. The most fundamental for loops in JavaScript have the appearance. The for keyword is used at the beginning of this kind of loop, followed by a series of parentheses. They each contain three optional expression statements that are separated by a semicolon,;. The code block statement that needs to be executed is enclosed by a set of curly brackets, or.

Learn more about  Java script here:

brainly.com/question/27683282

#SPJ4

You might be interested in
In a word processor, Tariq chooses Options from the Tools menu and then selects the Track Changes tab. Which of the following ta
bearhunter [10]

Highlight Changes

Compare Documents

3 0
4 years ago
What is a common citation style used by students for English classes?
geniusboy [140]

Answer:

MLA citations, in text and end-text, are commonly used by english students.

4 0
3 years ago
What is the only line in a photograph that can imply motion
kkurt [141]

The only line that can imply motion in a photo is a vertical line.

3 0
4 years ago
Select the correct answer from each drop-down menu. What is a distribution list and how is it selected?
Soloha48 [4]
Blank 1 is email, and blank 2 is contacts list
6 0
3 years ago
Realiza un algoritmo que calcule la edad de una persona y si es mayor = a 18 que imprima mayor de edad de lo contrario que impri
WINSTONCH [101]

Answer:

Explanation:

El siguiente codigo esta escrito en Java. Le pide al usario que marque la edad. Despues el programa analiza la edad y imprime a la pantalla si el usario es mayor de edad o menor de edad. El programa fue probado y el output se puede ver en la imagen abajo.

import java.util.Scanner;

class Brainly

{

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Cual es tu edad?");

       int age = in.nextInt();

       if (age > 18) {

           System.out.println("Mayor de Edad");

       } else {

           System.out.println("Menor de Edad");

       }

   }

}

7 0
3 years ago
Other questions:
  • The ____ problem-solving cycle involves inputting code to an assembler, translating it to machine language, loading it into a Vo
    10·1 answer
  • Torque is defined as _____.
    7·1 answer
  • What statement needs to be included below to retrieve all rows from the Invoices table with InvoiceTotal greater than 100?
    9·1 answer
  • Write about the future of Reliability and Security in Software Engineering.
    13·1 answer
  • What is the wave speed of a wave that has a frequency of 100 Hz and a wavelength of 0.30m?
    5·1 answer
  • a sign is to be hung from the end of a thin pole, and the pole supported by a single cable. your design firm brainstorms the six
    13·1 answer
  • Try to figure out who the ideal customer is for the IPhone X
    15·2 answers
  • Task 1: Alex has created the following code using Scratch and expected it to move backwards and forwards across the screen. Howe
    13·1 answer
  • What method do phishing and spoofing scammers use
    12·1 answer
  • Trees 1. 2. 3. 4. 5.​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!