Closed

Minimum of stack

This project was awarded to dsourajit for $55 USD.

Get free quotes for a project like this
Project Budget
$30 - $250 USD
Total Bids
2
Project Description

#include <iostream>

#include <string>

using namespace std;

struct stack {

​int arr[5];

​int top;

} s;

void push(stack & s, int x);

void min(stack s);

int main()

{

​int k;

​[url removed, login to view] = -1;

​bool n = true;

​while (n)

​{

​​int m;

​​cin >> m;

​​switch (m)

​​{

​​case 1:

​​​cin >>k;

​​​push(s, k);

​​​break;

​​case 2:

​​​min(s);

​​​break;

​​default: break;

​​}

​​cout << " \n Do you want to cotin....? press 1 or 0" << endl;

​​cin >> n;

​}

}

void push(stack & s, int x)

{

​if ([url removed, login to view] == 4)

​{

​​return;

​}

​else

​{

​​s.top++;

​​[url removed, login to view][[url removed, login to view]] = x;

​}

}

void min(stack s)

{

​int z;

​if ([url removed, login to view] == -1)

​{

​​cout << "error";

​}

​else

​{

​​z = [url removed, login to view][0];

​​for (int i = 0; i<[url removed, login to view]; i++)

​​{

​​​if ([url removed, login to view][i] < z)

​​​{

​​​​z = [url removed, login to view][i];

​​​}

​​}

​}

​cout << "min is " << z;

}

Awarded to:
Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online