Answer to Question #333023 in C++ for jhrbg

Question #333023

Taru exam is on the head. So she started learning physics. There she learned about Pascal's law. Now she wanted to try an experiment to get a better understanding of the same.

For, the experiment Taru has N buckets (numbered from 1,2,3...N) which all are initially empty.

She has M number of queries. Each query represents an integer that is of 4 types.


1
Expert's answer
2022-04-24T17:16:41-0400


#include <iostream>
#include <vector>
#include <iomanip>
#include  <fstream>
using namespace std;
int main()
{
  int n;
  cout<<"N:";
  cin>>n;
  vector<int>bucket;
  int m;
  for(int i=0;i<n;i++)
    {
      cin>>m;
      switch(m)
        {
          case 1:
            {
              cout<<"Do it\n";
            }
          case 2:
            {
              int nm;
              cin>>nm;
              bucket.push_back(nm);
            }
          case 3:
            {
              cout<<"============Buckets===============\n";
              for(auto it:bucket)
                cout<<it<<" ";
              cout<<endl;
            }
          
        }
    }
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS