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
If you were infiltrating a network (10.16.0.0/16), and searching for vulnerabilities (while trying to remain undetected), why wo
Juliette [100K]

Answer:

Yes, if you want to be undetected.

Explanation:

It is vital to always use a command that will ensure that one's activity is undetected. This is one of the important rules of corporate organizations to keep their data and activities safe and secure. The commend provided is a useful tool for detective works especially the activities of criminals and hackers. Therefore, if the admin wants to be undetected, the command should not be used.

8 0
2 years ago
Read 2 more answers
If there is a circuit that is being used 36 CCS then how much of that circuit is being used in Erlang?
Mkey [24]

Answer:

A.1.

Explanation:

CCS(Centum Call Seconds) is a unit to measure the network traffic in the telecommunication circuit network.        

1 Traffic unit = 1 Erlang.      

The relation between Erlang and CCS(Centum Call Seconds) is:-

36 CCS = 1 Erlang.          

Hence the answer to this question is 1 Erlang.

5 0
3 years ago
The photographer for "The Migrant Mother" photograph used _______________, which is a technique that would be considered unethic
d1i1m1o1n [39]

Answer:

The technique used by the photographer which would be considered unethical today is:

Stage Managing

Explanation:

  • The Migrant Mother is a famous that was captured by the photographer named Dorothea Lange. This photograph was taken during the era of great depression that shows the misery of a women as well as her courage.
  • The photographer used the stage managing technique because the women in the photograph purposefully posed for the picture in order to let others know about their plight. She wanted to develop awareness as well as wanted the Government to help farmers.
  • The name of the women in the picture is Florence Owens Thompson and she was a mother of seven children. She lived in California.

8 0
3 years ago
Read 2 more answers
JAVA
Katarina [22]

import java.util.Scanner;

public class JavaApplication83 {

   

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter Strings: ");

       String word1 = scan.nextLine();

       String word2 = scan.nextLine();

       String newWord = "";

       if (word1.length() == word2.length()){

           for (int i = 0; i < word1.length(); i++)

           {

               newWord += word1.charAt(i) +""+word2.charAt(i);

           }

       

       }

       else{

           newWord = "error";

       }

       System.out.println(newWord);

   }

   

}

I hope this helps!

4 0
2 years ago
Which term describes the second core IPSec security protocol; it can perform authentication to provide integrity protection, alt
Sphinxa [80]

Answer:

Encapsulating Security Payload (ESP)

Explanation:

Encapsulating Security Payload is also known as ESP, it is a protocol that exists within IPSec, it helps in determining the authentication, integrity and how confidential network pack data / Payload in IPV4 and IPV6 networks are.

ESP supplies messages /Payload encipher, it also helps in authenticating Payload as well as where it originated from in the IPSec protocol suite.

6 0
3 years ago
Other questions:
  • Drag each storage device to its category.
    7·1 answer
  • A third-grade teacher at Potter Elementary School wants a program that allows a student to enter the amount of money a customer
    14·1 answer
  • Write a complete Java program called Stewie2 that prints the following output. Use at least one static method besides main. ////
    9·2 answers
  • Given the business rule "an employee may have many degrees," discuss its effect on attributes, entities, and relationships. (Hin
    10·1 answer
  • The biggest limitation of a network operating system (NOS) is _____ in terms of memory, process, device, and file management.
    7·1 answer
  • Example of Not a computer characteristics example
    12·1 answer
  • What are the pros and cons of being a single decision maker
    8·1 answer
  • Avi does not want to save his internet browsing details on his computer. What should he do?
    11·1 answer
  • Please help me i’ll give you brainlist
    13·1 answer
  • ANs and WANs can be set up in several different shapes, also known as peripherals.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!