Question
In the Following code that is in C++ I get errors that say Too many arguments to function call, expected 0, have 1 or Too
In the Following code that is in C++ I get errors that say "Too many arguments to function call, expected 0, have 1" or "Too few arguments to function call, single argument 'element' was not specified" in the main.cpp when trying to enqueue and dequeue.
I can't for the life of me figure out why its giving me errors.
Thank you for your time, the code will be down below
Main.cpp
// Stack-Queue-Vector.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "StackV.h"
#include "QueueV.h"
#include
#include
using namespace std;
int main()
{
cout << "StackV and Queue V test program" << endl;
// Test StackV
// Create object with new
StackV* stack = new StackV();
cout << boolalpha << stack->empty() << endl;
stack->push(10);
stack->push(20);
stack->push(30);
stack->push(40);
cout << stack->top() << endl;
stack->push(50);
stack->push(60);
stack->push(70);
cout << stack->top() << endl;
stack->pop();
cout << stack->top() << endl;
stack->pop();
cout << stack->top() << endl;
stack->pop();
cout << stack->top() << endl;
// Delete object
delete stack;
// Create object with new
QueueV* queue = new QueueV();
queue->enqueue(10);
queue->enqueue(20);
queue->enqueue(30);
queue->enqueue(40);
cout << queue->front() << endl;
queue->enqueue(50);
queue->enqueue(60);
queue->enqueue(70);
cout << queue->front() << endl;
queue->dequeue();
cout << queue->front() << endl;
queue->dequeue();
cout << queue->front() << endl;
queue->dequeue();
cout << queue->front() << endl;
queue->display();
cout << std::boolalpha << queue->empty() << endl;
// Delete object
delete queue;
return 0;
}
StackV.Cpp
#include "StackV.h"
#include
using namespace std;
//constructor
StackV::StackV()
{
//default constructor
}
//--- Definition of empty()
//if vector is empty or not
bool StackV::empty()
{
//check to see if vector is empty to return that value
if(v.size()>0)
return false;
return (true);
}
//push into stack
void StackV::push(int value)
{
v.push_back(value);
// Figure out how to push a value onto the vector
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started