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
monitta
3 years ago
13

Write a program reverse-order.cpp which asks the user to input two dates (earlier date then later date). The program should repo

rt the West basin elevation for all days in the interval in the reverse chronological order (from the later date to the earlier).
Computers and Technology
1 answer:
xxMikexx [17]3 years ago
7 0

Answer:

reverse-order.cpp

#include<iostream>

#include <fstream>

#include <cstdlib>

#include <climits>

#include <sstream>

using namespace std;

#include <vector>

int main()

{

  ifstream fin("Current_Reservoir_Levels.tsv");

  if (fin.fail())

  {//check whether file exists or not

      cerr << "File cannot be opened for reading." << endl;

      exit(1);

  }

  //declare two vectors

  vector<string> Date;

  vector<float> westElVec;

  string header;

  getline(fin, header); // read one line from the file

  string dateArr[365], date;

  double eastSt, eastEl, westSt, westEl;

  string date1, date2;

  cout << "Enter starting date: ";

  cin >> date1; // getting starting date from user

 

  cout << "Enter ending date: ";

  cin >> date2; // getting ending date from user

  int count = 0;

  while (fin >> date >> eastSt >> eastEl >> westSt >> westEl)

  {

      fin.ignore(INT_MAX, '\n'); //skips to the end of line,

      //get the record from file

      //check if data is between the start and end or not

      if (date1 <= date && date2 >= date)

      {//insert the data

          Date.push_back(date);

          westElVec.push_back( westEl);

          count++;

      }

  }

 

  //sort the data by date indecending order

  for (int i = 0; i < count; ++i)

  {

      for (int j = 0; j < count - i - 1; ++j)

      {

          // Comparing consecutive dates

          if (Date[j] < Date[j + 1])

          {

              ////swap West basin elevation

              //double twestElVec = westElVec[j];

              //westElVec[j] = westElVec[j + 1];

              //westElVec[j + 1] = twestElVec;

              //swap dates

              string tDate = Date[j];

              Date[j] = Date[j + 1];

              Date[j + 1] = tDate;              

          }

      }

  }  

  for (int i = 0; i < count; i++)

      cout << Date[i] << "\t" << westElVec[i] <<"ft"<< endl;

  fin.close();

  //system("pause");

return 0;

}

Explanation:

You might be interested in
If your computer system is not working correctly, you can use System Restore to return the ___________ ____________ to an earlie
Luden [163]

You can use System Restore to return the computer file history to an earlier point in time.

Explanation:

System Restore allows you to recover documents/files that may have been deleted if your computer is not operating as it should be. Therefore, the answer is "computer file history".


Hope this helps!

7 0
4 years ago
which two statements about incoming and outgoing interfaces in firewall policies are true? (choose two.)
Ratling [72]

The statements that are true regarding incoming and outgoing interfaces in firewall policies are:

  • A zone can be chosen as the outgoing interface.
  • -Multiple interfaces can be selected as incoming and outgoing interfaces.

<h3>What is a firewall?</h3>

A firewall is a network security device used in computing that monitors and regulates incoming and outgoing network traffic in accordance with pre-established security rules. Typically, a firewall creates a wall between a trustworthy network and an unreliable network, like the Internet.

A firewall aids in defending your network from intruders. A firewall protects your network by operating as a continuous filter that constantly scans incoming data and blocks anything that appears to be suspicious.

Therefore, the statements that are true regarding incoming and outgoing interfaces in firewall policies are:

A zone can be chosen as the outgoing interface.

-Multiple interfaces can be selected as incoming and outgoing interfaces.

Learn more about firewall on:

brainly.com/question/13693641

#SPJ1

Which statements are true regarding incoming and outgoing interfaces in firewall policies? (Choose two.)

Select one or more:

-An incoming interface is mandatory in a firewall policy, but an outgoing interface is optional.

-A zone can be chosen as the outgoing interface.

-Only the any interface can be chosen as an incoming interface.

-Multiple interfaces can be selected as incoming and outgoing interfaces.

4 0
2 years ago
When creating an input/output table, where do you enter the formula?
balu736 [363]

When creating an input/output table, where do you enter the formula?  

A. In the input cell

B. In the output cell

C. In the title cell

D. In the table of contents


<u>ans. (B) In the output cell</u>

4 0
3 years ago
Write an expression in Boolean algebra that evaluates to 1 when an odd number of bits of the number is 1 and 0 otherwise
Leokris [45]

α∨1=1 is an example of boolean algebra with result equal to 1.

<h3>What is boolean algebra?</h3>

Are algebraic structures that "capture the essential properties" of logical and set operators, or provide a structure for dealing with "statements".

With this information, we can conclude that The purpose of Boolean algebra is to describe signal processing, in the form of an algebraic expression.

Learn more about Boolean algebra in brainly.com/question/2467366

3 0
3 years ago
Use set builder notation to describe these sets.
statuscvo [17]

Answer:

a) S1 = { 2^x | x belongs to the set of Whole Numbers}

b) S2 = { 2+3(x-1) | x belongs to Natural Numbers }

c) S3 = { x^2 | x belongs to the set of Natural Numbers  }

d) S4 = { x | x belongs to English Alphabet }

e) S5 = { x | x is a <em>Vowel</em> of English Alphabet}

Explanation:

Whole Numbers = {0, 1, 2, 3, ...}

Natural Numbers = {1, 2, 3, ...}

English Alphabet={a, b, c, d, e, ... , x, y, z }

Vowels of English Alphabet = {a, e, i, o, u}

8 0
3 years ago
Other questions:
  • What is the definition of legal intrusion
    14·1 answer
  • The World Wide Web is a program that allows you to search for information on the Internet.
    11·1 answer
  • What happened if the offshore team members are not able to participate in the iterations demo due to timezone/infrastructure iss
    12·1 answer
  • Which statement best compares routers and hubs?
    9·1 answer
  • Which of these is an example of a mobile app?
    12·2 answers
  • Libby’s keyboard is not working properly, but she wants to select options and commands from the screen itself. Which peripheral
    14·1 answer
  • If my usb could unlock my computer with a tool then could i be able to open it using ip unlock
    9·1 answer
  • What is one of four key principles of Responsible Artificial Intelligence
    5·1 answer
  • While storms could be a cause, power______ are more likely to be caused by disturbances from high-demand equipment in a home or
    8·1 answer
  • What are two advantages of edge computing over cloud computing?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!