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
kumpel [21]
3 years ago
14

) Consider the array called myArray declared below that contains and negative integers. Write number of positive integers in the

array. That is, your loop display the message "Number of positive integers is 5" a loop statement to count and display the should (4 points) int myArray[]卟1,3,-9,9,33,-4,-5, 100,4,-23); Note: The loop should always work without modification even if the values in th array are changed
Computers and Technology
1 answer:
grigory [225]3 years ago
6 0

Answer:

#include <iostream>

using namespace std;

int main()

{

 

  int arr[]={3,-9,9,33,-4,-5, 100,4,-23};

  int pos;

  int n=sizeof(arr)/sizeof(arr[0]);

  for(int i=0;i<n;i++){

      if(arr[i]>=0){

          pos++;

      }

  }

  cout<<"Number of positive integers is "<<pos<<endl;

  return 0;

}

Explanation:

create the main function in the c++ programming and declare the array with the element. Then, store the size of array by using the formula:

int n=sizeof(arr)/sizeof(arr[0]);

after that, take a for loop for traversing the array and then check condition for positive element using if statement,

condition is array element greater than or equal to zero.

if condition true then increment the count by 1.

this process happen until the condition true

and finally print the count.

You might be interested in
What's good computing?
cestrela7 [59]

Answer:

1.Use passwords that can't be easily guessed, and protect your passwords.

2.Minimize storage of sensitive information.

3.Beware of scams.

4.Protect information when using the Internet and email.

5.Make sure your computer is protected with anti-virus and all necessary 6.security "patches" and updates.

7.Secure laptop computers and mobile devices at all times: Lock them up or carry them with you.

8.Shut down, lock, log off, or put your computer and other devices to sleep before leaving them unattended, and make sure they require a secure password to start up or wake-up.

9.Don't install or download unknown or unsolicited programs/apps.

Secure your area before leaving it unattended.

10.Make backup copies of files or data you are not willing to lose.

Explanation:

7 0
2 years ago
A company wishes to deploy a wireless network. Management insists that each individual user should have to authentic.ate with a
kap26 [50]

Answer:

A company wishes to deploy a wireless network. Management insists that each individual user should have to authentic.ate with a unique username and password before being able to associate with the wireless access points. Which of the following wireless features would be the MOST appropriate to achieve this objective?

Option A is the correct answer -  WPA2 PSK.

Explanation:

Data is the most essential asset for obtaining knowledge and information. Therefore, it has to be protected from various threats. However, the wireless network provides the option of sharing data without wires, but it is flying in the air. Thus, to secure it, we need to secure it with the right tools.

Option A: WI-FI Protected Access Pre-shared-Key (WPA2 PSK) is the best protection tool because it has 2 modes-PSK and Enterprise mode.

7 0
3 years ago
Read 2 more answers
Code a complete Java program to load and process a 1-dimensional array.
zepelin [54]

Answer:

Here you go.Consider giving brainliest if it helped.

Explanation:

import java.io.*;//include this header for the file operation

import java.util.*;//to perform java utilities

import javax.swing.JOptionPane;//needed fro dialog box

class Driver{

  public static void main(String args[]){

      int wages[]=new int[15];//array to hold the wages

      int index=0;

      try{

          //use try catch for the file operation

          File file=new File("wages.txt");

          Scanner sc=new Scanner(file);//pass the file object to the scanner to ready values

          while(sc.hasNext()){

              String data=sc.nextLine();//reads a wage as a string

              String w=data.substring(1);//remove the dollar from the string data

              wages[index++]=Integer.parseInt(w);//convert the wage to int and store it in the array

          }

          sc.close();//close the scanner

      }catch(FileNotFoundException e){

          System.out.println("Error Occurrred While Reading File");

      }

     

      //sort the array using in built sort function

      Arrays.sort(wages);

      //print the wages

      System.out.println("Wages of 15 person in ascending order:");

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

          System.out.print("$"+wages[i]+" ");

      }

      //call the increases wages method

      wages=increaseWages(wages);//this method return the updated wages array

     

  }

 

  //since we can call only static methods from main hence increaseWages is also static

  public static int[] increaseWages(int wages[]){

      //increase the wages

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

          wages[i]+=500;

      }

     

      //print the new wages

      int sum=0;

      System.out.println("\n\nNew wages of 15 person in ascending order:");

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

          sum+=wages[i];//sums up the new wages

          System.out.print("$"+wages[i]+" ");

      }

     

      //display the summation of the new wages in a dialog box

      JOptionPane.showMessageDialog(null,"Total of new wages: "+sum);

      return wages;

  }

}

6 0
3 years ago
Which country does coriander come from
lawyer [7]
Coriander comes from<span> Morocco and Romania</span>
4 0
3 years ago
Read 2 more answers
Compare and contrast assertiveness, arrogance and passivity.
bekas [8.4K]

Assertiveness is self-confidence that does not infringe on the feelings of others. Assertiveness allows a person to state their needs and assert their ideas. Arrogance, on the other hand, is highly confrontational. An arrogant individual insists on their viewpoint or idea because it is theirs, rather than the best possibility. A passive person, on the other hand, is unwilling to assert their needs and wants. They often put themselves in difficult positions because they are unwilling to refuse requests and demands on their time based on the idea of avoiding confrontation.

3 0
3 years ago
Other questions:
  • Where could identity theft access your personal information?
    12·2 answers
  • Phoebe has to give a presentation about recycling. Where should she look while presenting?
    14·2 answers
  • 1.Which type of camera tool pushes the picture back and makes it wider, exaggerating the distance between the background and for
    13·2 answers
  • 11.
    13·1 answer
  • T is important to remember to print the return address when printing an
    5·1 answer
  • Which of the following is not a property of a constructor?A. The name of a constructor can be chosen by the programmerB. A const
    11·1 answer
  • 15
    5·2 answers
  • Given two int variables , firstplacewinner and secondplacewinner, write some code that swaps their values . declare any addition
    11·1 answer
  • How does computer number system play a Vital role in a computer calculation. ​
    8·1 answer
  • What is the meaning of FTTH
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!