Library 2

Fixed issue #3 and fixed another bug.
This commit is contained in:
Alessandro Ferro 2021-04-22 18:30:26 +02:00
parent 9c17978640
commit e6cb9848ff
5 changed files with 4 additions and 5 deletions

View File

@ -5,4 +5,4 @@ g++ -g -O3 -o main \
zlasdtest/exercise1/simpletest.cpp zlasdtest/exercise1/fulltest.cpp \ zlasdtest/exercise1/simpletest.cpp zlasdtest/exercise1/fulltest.cpp \
zlasdtest/exercise2/simpletest.cpp zlasdtest/exercise2/fulltest.cpp \ zlasdtest/exercise2/simpletest.cpp zlasdtest/exercise2/fulltest.cpp \
zlasdtest/container/container.cpp \ zlasdtest/container/container.cpp \
zlasdtest/test.cpp main.cpp zlasdtest/test.cpp zmytest/test.cpp main.cpp

Binary file not shown.

View File

@ -180,7 +180,7 @@ void QueueVec<Data>::Reduce(){
ulong newsize = (ulong)size/2; ulong newsize = (ulong)size/2;
Data* tmp = new Data[newsize]; Data* tmp = new Data[newsize];
ulong current_index = front , i=0; ulong current_index = front , i=0;
while(i < newsize){ while(current_index != rear){
tmp[i] = Elements[current_index]; tmp[i] = Elements[current_index];
current_index = (current_index+1)%size; current_index = (current_index+1)%size;
++i; ++i;
@ -189,7 +189,7 @@ void QueueVec<Data>::Reduce(){
Elements = tmp; Elements = tmp;
front = 0; front = 0;
rear = i; rear = i;
size *= 2; size = newsize;
} }
} }

View File

@ -213,7 +213,7 @@ void QueueFunctions(T& queue){
std::cout<<"4. Lettura non distruttiva (Head)"<<std::endl; std::cout<<"4. Lettura non distruttiva (Head)"<<std::endl;
std::cout<<"5. Test di vuotezza"<<std::endl; std::cout<<"5. Test di vuotezza"<<std::endl;
std::cout<<"6. Dimensione"<<std::endl; std::cout<<"6. Dimensione"<<std::endl;
std::cout<<"7. Clear Stack"<<std::endl; std::cout<<"7. Clear Queue"<<std::endl;
std::cout<<"8. Vai indietro"<<std::endl; std::cout<<"8. Vai indietro"<<std::endl;
std::cout<<"9. Esci"<<std::endl; std::cout<<"9. Esci"<<std::endl;
std::cin>>std::ws; std::cin>>std::ws;

View File

@ -68,5 +68,4 @@ std::string generateRandomString(ulong);
ulong getDimension(); ulong getDimension();
/* ************************************************************************** */ /* ************************************************************************** */
#include"test.cpp"
#endif #endif