push
This commit is contained in:
parent
23d21b42ca
commit
81a88d6af1
|
|
@ -0,0 +1,14 @@
|
||||||
|
#include "Span.hpp"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
Span sp = Span(5);
|
||||||
|
sp.addNumber(6);
|
||||||
|
sp.addNumber(3);
|
||||||
|
sp.addNumber(17);
|
||||||
|
sp.addNumber(9);
|
||||||
|
sp.addNumber(11);
|
||||||
|
std::cout << sp.shortestSpan() << std::endl;
|
||||||
|
std::cout << sp.longestSpan() << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,7 @@ CXXFLAGS = -Wall -Wextra -Werror -std=c++98
|
||||||
OBJDIR = obj
|
OBJDIR = obj
|
||||||
SOURCES = Main.cpp
|
SOURCES = Main.cpp
|
||||||
OBJECTS = $(addprefix $(OBJDIR)/, $(SOURCES:.cpp=.o))
|
OBJECTS = $(addprefix $(OBJDIR)/, $(SOURCES:.cpp=.o))
|
||||||
NAME = Easyfind
|
NAME = Span
|
||||||
|
|
||||||
all: $(NAME)
|
all: $(NAME)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
#include "Span.hpp"
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
#ifndef SPAN_HPP
|
||||||
|
#define SPAN_HPP
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class Span
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
unsigned int _n;
|
||||||
|
std::vector<int> _vec;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Span();
|
||||||
|
Span(const unsigned int n);
|
||||||
|
~Span();
|
||||||
|
Span(const Span& other);
|
||||||
|
Span &operator=(const Span& other);
|
||||||
|
|
||||||
|
int shortestSpan() const;
|
||||||
|
int longestSpan() const;
|
||||||
|
void addNumber(int x);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue