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
2 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]2 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
You are looking at computer ads. One has a processor that is 3.64GHz. What does this mean?
aliina [53]

Answer:

The higher the clockspeed the more the cpu can do

Explanation:

8 0
2 years ago
Which type of hacker represents the highest risk to your computer?
Deffense [45]

Answer:

The hacker which represents the highest risk to my computer is the Script Kiddie.

Explanation:

A Script Kiddie cannot make their own programs.

They hack by using existing codes, scripts, web shells etc to access a work station, mutilate webpages etc.

The difference between a Hacker and a Script Kiddie is that a hacker does not need another person's code. They are skilled at writing their own codes which are can be very potent. This level of skill can be difficult to attain except for very bright minds.

The script kid needs very little knowledge of scripts and they are well on their way to causing damage.

Cheers!

4 0
2 years ago
Lenny copied and pasted content from a commercial website into his research paper without citing his source, passing the work of
Sedbober [7]
Lenny might be either suspended
Or might be failed in that particular course
6 0
8 months ago
Assume that you are testing the Orders database introduced in Watt (2014) - Appendix C. Discuss the problems and possible conseq
madreJ [45]

Answer:

129 \frac{2}{?} 23.4. \div 164 \times 5y1 + . \\ .00487ggh

6 0
3 years ago
Dallas is an analyst at an online retailer. He is great at creating representative diagrams showing the relationships between cu
dimulka [17.4K]

Answer:

The correct answer to the following question will be "Abstract Reasoning".

Explanation:

  • Abstract reasoning depends on the ability to interpret facts, to identify correlations and interactions and to resolve the problems at a deep, conceptual level.
  • To be able to construct hypotheses about both the existence of events and concepts require abstract reasoning capabilities.

This suggests, therefore, that Dallas has this ability.

4 0
3 years ago
Other questions:
  • Identify the six components of an information system. Which are most directly affected by the study of computer security? Which
    8·1 answer
  • Explain how to identify a starting position on a line.
    15·2 answers
  • How can you achieve an effect like that shown in the image?
    7·2 answers
  • A bicycle combination lock has four rings with numbers 0 through 9. Given the actual numbers and the combination to unlock, prin
    13·1 answer
  • Which if the following ribbons in Microsoft word is used to add tables and images
    14·1 answer
  • Write a regular expression that selects lines containing any of the following words: linux windows solaris macos. For this exerc
    13·1 answer
  • The simplest element that exists is only one proton and one electron. It is what stars are made of. It's symbol is "H". What is
    9·1 answer
  • Tier 1 networks form the internet ____.​
    15·1 answer
  • Which of the following is not a bus type A. Address bus B. Data bus C. Memory bus D. Control bus ​
    7·2 answers
  • Why is computer economics important?​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!