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
vodomira [7]
2 years ago
9

Write a complete C++ program that do following. Read a positive integer from the user with proper prompt. Assume that this user

is nice and he/she would not start the integer with digit 0. Create a size 10 array as counters for digits 0 - 9 Use a while loop for processing

Computers and Technology
1 answer:
exis [7]2 years ago
5 0

Answer:

The cpp program for the given scenario is shown below.

#include <stdio.h>

#include <iostream>

using namespace std;

int main()

{

//variable for while loop

   int n=0;

   //size of array declared

   int size=10;

   //integer array declared

   int num[size];

   //user enters elements for the array inside while loop

   while(n<size)

   {

       std::cout << "Enter a positive number: ";

       cin>>num[n];

n++;

   }

   std::cout << "Thanks for entering the numbers. Program ends." << std::endl;

   return 0;

}

Explanation:

1. The integer variable, size, is declared and initialized to hold the size of the array.

int size=10;

2. Another integer variable, n, is declared to be used in the while loop.

int n=0;

3. An integer array, num, is declared having the capacity of integer variable, size.

int num[size];

4. Inside the while loop, the user is prompted to enter a positive number.

std::cout << "Enter a positive number: ";

5. The user-entered number is assigned directly to the array.

cin>>num[n]

6. After input is taken, the variable n is incremented by 1.

n++;

7. The while loop executes over variable n for the range of values from 0 to size-1,  i.e., until the array is filled. The first index of the array is 0 and increments henceforth. The variable is declared outside the loop unlike the for loop.

while(n<size)

8. In this program, all the code is written inside main().

9. Since cpp is not a purely object-oriented language, it is not mandatory to write the code inside the class for a simple program like this.

10. The program ends with a message for the user.

std::cout << "Thanks for entering the numbers. Program ends." << std::endl;

11. The return statement indicates the end of main() method.

return 0;

12. The output of the program is attached as an image.

13. The program can be tested for any value of variable size.

You might be interested in
What is the function of a primary key in a table? to uniquely identify each record in the table to uniquely identify foreign key
aev [14]

Answer:

A. To uniquely identify each record in the table

brainliest pls?

6 0
2 years ago
Write a recursive function sumAll that accepts an integer argument and returns the sum of all the integers from 1 up to the numb
slavikrds [6]

Answer:

int sumAll(int n)//function definition.

{

   if(n==1)//if condition.

   return 1;

   else//else condition.

   {

       return n+sumAll(n-1);//return the value and call the function in recursive manner.

   }

}

Explanation:

  • The above-defined function is a recursive type function that is written in the c language, which holds the if and else condition.
  • When the user passes the largest value from 1, then the else condition will be executed which adds the largest value and pass the value after the decrement of the value as an argument.
  • When the value will become 1, then the function if-block will be executed which returns the value and ends the calling function recursively.
8 0
3 years ago
Which statement reflects an opinion about technology? Select all that apply. Select one or more: a. It is easy to imagine that a
True [87]

Answer:

All options apply to the question because each one reflects one side of technology in relation to the artist's case (that could be a software engineer or a even a hardware designer).

Explanation:

Letter a applies to the question in terms of computer program's behavior with no people's assistance, which is something not real for the present time, although it is easy to imagine that it is going to be a reality in a near future for all the improvements engineers and developers have made. Letter b also applies because computers and softwares have become one of the most important tools for artists around the world, whether for researching and/or for sharing and/or selling their productions, however it is a radical idea to think an artist is not necessary anymore, that is similiar to say human beings are not necessary only because machines have improved. Letter c also applies to the question for all improvements made in art and art forms after all improvements made in technology and tools for technologies development. And, letter d also applies because computers may be used for studying and/or working, which is the perfect tool for a workplace, and this is why it has become essential in many organizations, companies, subsidiaries, agencies, schools, and more.

3 0
3 years ago
Which is a circuit board located behind an LCD screen on a laptop?
mina [271]

Answer:

Inverter is an electronic circuit that is located behind the LCD screen on a laptop.

Explanation:

Inverter is an electronic device that is used to convert DC voltage into AC voltage. This will lead to control the output power that is required to Liquid Crystal display. The Output power is limit up to the requirement of Florescent light that are used in Liquid crystal display to make picture visible.

This Inverter is just behind the LCD in laptop to control the lights on the display of screen.

4 0
2 years ago
Typically, you need to score _____ or higher on an AP exam to receive college credit for the AP course in the subject tested by
ss7ja [257]

the answer is A). 3 or higher

7 0
3 years ago
Read 2 more answers
Other questions:
  • Compare and contrast how the roles of women and men in society are changing​
    14·1 answer
  • You can leave out the ____ statements in a switch structure.
    15·1 answer
  • When is Hytale coming out?<br><br><br> P.S it might be Mine-craft 2.0<br><br><br> :)
    7·1 answer
  • Ned and Mary Ann are saving their files to a CD. When prompted, Ned will click on Burn file to disk, indicate the recording spee
    15·1 answer
  • Write an if-else statement for the following: If user_tickets is less than 5, assign 1 to num_tickets. Else, assign user_tickets
    15·1 answer
  • What is are motor vehicle emissions?
    8·1 answer
  • An image that has been saved in Tagged Image File Format (or .TIF) is A. readable only by Windows personal computers. B. a recto
    6·1 answer
  • D is the correct answer
    8·2 answers
  • Write a one page report describing the computer the client used, who else had access to it and other relevant findings. Referenc
    7·1 answer
  • 1.Microsoft Word is a/an ........​
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!