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
Studentka2010 [4]
2 years ago
7

Write a program second.cpp that takes in a sequence of integers, and prints the second largest number and the second smallest nu

mber. Note that in the case of repeated numbers, we really mean the second largest and smallest out of the distinct numbers (as seen in the examples below). You may only use the headers: and .
Computers and Technology
1 answer:
sergey [27]2 years ago
4 0

Answer:

The program is as follows:

#include <iostream>

#include <vector>

using namespace std;

int main(){

   int n;

   cout<<"Elements: ";

   cin>>n;

   vector <int>vectnum;

   int numInp;

   for (int i = 1; i <= n; i++){        cin>>numInp;        vectnum.push_back(numInp);    }

   int big, secbig;

   big = vectnum.at(0);      secbig = vectnum.at(1);

   if(vectnum.at(0)<vectnum.at(1)){     big = vectnum.at(1);  secbig = vectnum.at(0);   }

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

     if (vectnum.at(i) > big) {

        secbig = big;;

        big = vectnum.at(i);

     }

     else if (vectnum.at(i) > secbig && vectnum.at(i) != big) {

        secbig = vectnum.at(i);

     }

  }

  cout<<"Second Largest: "<<secbig<<endl;

  int small, secsmall;

  small = vectnum.at(1);       secsmall = vectnum.at(0);

  if(vectnum.at(0)<vectnum.at(1)){ small = vectnum.at(0);  secsmall = vectnum.at(1);   }

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

     if(small>vectnum.at(i)) {  

        secsmall = small;

        small = vectnum.at(i);      }

     else if(vectnum.at(i) < secsmall){

        secsmall = vectnum.at(i);      }   }

  cout<<"Second Smallest: "<<secsmall;

  return 0;

}

Explanation:

See attachment for explanation

Download cpp
You might be interested in
An 18 year old female is preparing to go to college in the Fall. She received the 1st dose of HPV and her booster dose of Mening
Elenna [48]

Answer: No, you will not have to determine the exact vaccine that caused the fever and rash. The CDC will determine that information.

Explanation:

To report a vaccine reaction to VAERS you just have to list the symptoms and reactions that were caused after getting a vaccine. The form that is needed to fill out a VAERs can be found on the CDC website. The person filling out the form will need to know the who, when, where, and how of the injury or symptom.

After the form has been received the patient will be contacted and their symptoms will be monitored. Some of the most common reactions after getting a vaccine are;

  • swelling
  • pain
  • redness
  • rash

4 0
3 years ago
NEED HELP FAST TIMED !!!!
Trava [24]

Answer:

oil rings = encloses combustion by closing off the extra space between the block and the head,

crank shaft = connects the engine to the transmition through a series of mechanisms.

gasket = reduces the amount of exhaust inside the cylinder by sealing the cylinder.

Explanation:

3 0
3 years ago
Read 2 more answers
EBay is an example of an online company that has been faced with numerous security issues. For example, imagine you purchase a d
Bond [772]

Answer: d)Phishing

Explanation: Phishing is the activity that is used by the attackers or unauthorized parties to steal confidential information of individuals through emails, messages or calls.This activity is considered as cyber-crime as the unauthorized source present themselves as the legal and actual party to gain private information such as credit card details, personal details , etc.

The example mentioned in the question about eBay's security issue is also related with phishing  where the fraud mails are sent to the users to gain or steal their personal information.

Other options are incorrect because insider is a threat that happens in the organization or business field regarding the organizational data,dumpster diving is reviving data to execute an attack on operating system and social engineering is gaining personal information from an individual through manipulation .Thus, the correct option is option(d).

Phishing is a cybercrime in which a target or targets are contacted by email, telephone or text message by someone posing as a legitimate institution to lure individuals into providing sensitive data such as personally identifiable information, banking and credit card details, and passwords.

7 0
3 years ago
Examples of intermediate technology​
Effectus [21]

Example of intermediate technology is the treadle pump, which enables farmers to provide a greater amount of water to their plants more easily compared to watering by bucket, while requiring much less infrastructure than constructing irrigation dams and pipes.

3 0
3 years ago
Read 2 more answers
How do i install java runtime environment?
nlexa [21]
Just go to the internet and download the file and install
please mark as brainliest

3 0
3 years ago
Other questions:
  • At regular intervals the AP in an infrastructure network or wireless device in an ad hoc network sends a ____ frame both to anno
    8·1 answer
  • What is the next series of dragon ball super
    6·2 answers
  • Which of the following rules should be used to keep the appropriate distance between your vehicle and the vehicle in front of yo
    10·2 answers
  • ____________________ are compromised systems that are directed remotely (usually by a transmitted command) by the attacker to pa
    7·2 answers
  • Which team won the first World Series ?
    11·2 answers
  • A seven-octet pattern of alternating 0s and 1s used by the receiver to establish bit synchronization is a _______
    11·1 answer
  • Security administrator for your organization utilized a heuristic system to detect an anomaly in a desktop computer's baseline.
    7·1 answer
  • Before you can use a navigation control, you must _____. A. configure the web.config B. configure the global.asax C. configure t
    5·2 answers
  • What makes a source credible?
    9·2 answers
  • You are an IT administrator troubleshooting a Windows-based computer. After a while, you determine that you need to refresh the
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!