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
Darpa was created to
I am Lyosha [343]
Darpa is an agency that emerges technologies for the military. I would say B. investigate technologies. This is logical because they are working with technologies investigating how, where, and why they need to emerge in the first place.
7 0
3 years ago
What are the advantages of mine shaft gear and the disadvantaged​
romanna [79]

Answer:

One sheave means that you are using a single drum winder. They are the worst! Double drum winders control easier, brake better and are much more efficient. They save time ( two skips or cages) and can be clutched to perform faster shift transport. A single drum is slow, unbalanced and can be a nightmare if it trips out during hoisting. If the brake system is not perfect it can be a real hairy experience. For a runaway single drum, there is no counterbalance effect. It always runs to destruction. With a double drum, the driver still has a chance to control the winder to a certain extent and he has two sets of brakes to rely on. A single sheave could also mean a shaft with a single compartment. No second means of escape unless there are ladders or stairways. Not a very healthy situation.

Those are just a few points. I am sure much more can be said in favor of a double drum winder and two or more sheaves in the headgear. Most of the shafts I have worked at have multiple winders and up to ten compartments. They all have a small single drum service winder for emergencies and moves of personnel during shift times. They are referred to as the Mary - Annes. Apparently, the name originated in the U.K. where an aristocratic mine owner named the first such winder after his mistress.

Explanation:

<em>Hope you got it </em>

<em>If you have any question just ask me</em>

<em>If you think this is the best answer please mark me as BRAINLIEST</em>

5 0
3 years ago
Sam plans to use this image in artwork for a brochure about airplanes. Which principles of page layout is Sam planning to use in
Fittoniya [83]

Answer: Alignment

Explanation:

The principle of repitition indicates that some aspect of a design are repeated. This can be in form of bullet list, lines, color etc.

Balance has to do with how the weight is distributed.

The Principle of Alignment means that the pictures on a page should be connected visually to another thing.

Principle of Proximity simoly means that the items that are related on a page should be close to each other.

Therefore, the principles of page layout that Sam is planning to use in this artwork is alignment.

6 0
2 years ago
Given: an int variable k, an int array current Members that has been declared and initialized, an int variable memberID that has
Alekssandra [29.7K]

Answer:

The c++ program is given below. Nothing is displayed as per the question.

#include <iostream>

using namespace std;

int main() {    

   // declaration and initialization of integer variables

   int k, memberID = 12, nMembers=5;

   bool isAMember;    

   // declaration and initialization of integer array

   int currentMembers[] = {12, 34, 56, 78, 90};    

   for(k=0; k<nMembers; k++)

   {

       if(memberID == currentMembers[k])

       {

           // when member is found in the array, the loop is exited using break

           isAMember = true;

           break;

       }

       else

           isAMember = false;

   }    

   return 0;

}

Explanation:

The program begins with declaration and initialization of integer variables and followed by initialization of the array holding the id of all the members.

The Boolean variable is declared but not initialized.

int k, memberID = 12, nMembers=5;

bool isAMember;

int currentMembers[] = {12, 34, 56, 78, 90};

After this, the array holding the id of the members is searched for the given member id. This is done using  a for loop and a if else statement inside the loop.

If the member id is present in the array, the variable isAMember is initialized to true otherwise it is assigned false.

When the variable isAMember is initialized to true, the break statement is used to exit from the loop.

for(k=0; k<nMembers; k++)

   {

       if(memberID == currentMembers[k])

       {

           isAMember = true;

           break;

       }

       else

           isAMember = false;

 }

The break is used since other values of id in the array will not match the given member id and the variable, isAMember will be initialized to false even if the given member id is present in the array. Hence, it is mandatory to exit the loop once the given member id is found in the array.

This program can be tested for different values of the id of the members and different sizes of the array.

4 0
3 years ago
Consider the following code:
Deffense [45]

Answer:

The output of C is 102.

100 + 1 + 1 = 102

8 0
3 years ago
Other questions:
  • Image files are grouped into two categories: _____.
    5·1 answer
  • Suppose a worker needs to process 100 items. the time to process each item is exponentially distributed with a mean of 2 minutes
    5·1 answer
  • To quit Word, click the Restore button on the right side of the title bar. <br> True <br> False
    6·1 answer
  • Which is a real-world example of a procedure?
    11·1 answer
  • By using the search functionality within a twitter stream, users can filter for:
    9·1 answer
  • Write a paragraph on the following topic.
    14·1 answer
  • Which of the following is not considered format?
    8·2 answers
  • A stateless firewall inspects each incoming packet to determine whether it belongs to a currently active connection.
    9·1 answer
  • How to get someone off your best friends list without blocking them
    8·1 answer
  • 30 Points!!
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!