diff --git a/librerie/exercise2/main b/librerie/exercise2/main index 972f20b..c49082d 100755 Binary files a/librerie/exercise2/main and b/librerie/exercise2/main differ diff --git a/librerie/exercise2/zmytest/test.cpp b/librerie/exercise2/zmytest/test.cpp index dbe4cd7..c8cc2df 100755 --- a/librerie/exercise2/zmytest/test.cpp +++ b/librerie/exercise2/zmytest/test.cpp @@ -85,29 +85,34 @@ void UseChosenType(DataStructure chosenDataStructure, DataType chosenDataType, I if(chosenDataType == DataType::integer){ StackVec stckvec; stckvec = generateRandomStackVecInt(); - StackIntFunctions(stckvec); + StackFunctions(stckvec); } else if(chosenDataType == DataType::ffloat){ StackVec stckvec; stckvec = generateRandomStackVecFloat(); + StackFunctions(stckvec); } else if(chosenDataType == DataType::sstring){ StackVec stckvec; stckvec = generateRandomStackVecString(); + StackFunctions(stckvec); } } else if(chosenImplementation == Implementation::list){ if(chosenDataType == DataType::integer){ StackLst stcklst; stcklst = generateRandomStackLstInt(); + StackFunctions(stcklst); } else if(chosenDataType == DataType::ffloat){ StackLst stcklst; stcklst = generateRandomStackLstFloat(); + StackFunctions(stcklst); } else if(chosenDataType == DataType::sstring){ StackLst stcklst; stcklst = generateRandomStackLstString(); + StackFunctions(stcklst); } } } @@ -116,35 +121,41 @@ void UseChosenType(DataStructure chosenDataStructure, DataType chosenDataType, I if(chosenDataType == DataType::integer){ QueueVec queuevec; queuevec = generateRandomQueueVecInt(); + QueueFunctions(queuevec); } else if(chosenDataType == DataType::ffloat){ QueueVec queuevec; queuevec = generateRandomQueueVecFloat(); + QueueFunctions(queuevec); } else if(chosenDataType == DataType::sstring){ QueueVec queuevec; queuevec = generateRandomQueueVecString(); + QueueFunctions(queuevec); } } else if(chosenImplementation == Implementation::list){ if(chosenDataType == DataType::integer){ QueueLst queuelist; queuelist = generateRandomQueueListInt(); + QueueFunctions(queuelist); } else if(chosenDataType == DataType::ffloat){ QueueLst queuelist; queuelist = generateRandomQueueListFloat(); + QueueFunctions(queuelist); } else if(chosenDataType == DataType::sstring){ QueueLst queuelist; queuelist = generateRandomQueueListString(); + QueueFunctions(queuelist); } } } } template -void StackIntFunctions(T& stk){ +void StackFunctions(T& stk){ unsigned short int choice; do{ std::cout< -void PushInt(T& stk){ - int element; +void QueueFunctions(T& queue){ + unsigned short int choice; + do{ + std::cout<>std::ws; + std::cin>>choice; + std::cout< class C, typename T> +void Enqueue(C& queue){ + T element; + std::cout<<"Element to enqueue: "; + std::cin>>std::ws; + std::cin>>element; + queue.Enqueue(element); +} + +template +void Dequeue(T& queue){ + queue.Dequeue(); +} + +template +void HeadNDequeue(T& queue){ + std::cout<<"The head and dequeued element is "< +void Head(T& queue){ + std::cout<<"The head is "< class C, typename T> +void Push(C& stk){ + T element; std::cout<<"Element to push: "; std::cin>>std::ws; std::cin>>element; @@ -213,7 +298,7 @@ void Top(T& stk){ template void Empty(T& stk){ - std::cout<<"Stack is "; + std::cout<<"It is "; stk.Empty()? std::cout<<"" : std::cout<<"not "; std::cout<<"empty"; } @@ -226,7 +311,7 @@ void Size(T& stk){ template void Clear(T& stk){ stk.Clear(); - std::cout<<"Stack has been cleared."; + std::cout<<"It has been cleared."; } diff --git a/librerie/exercise2/zmytest/test.hpp b/librerie/exercise2/zmytest/test.hpp index d25e478..d491784 100755 --- a/librerie/exercise2/zmytest/test.hpp +++ b/librerie/exercise2/zmytest/test.hpp @@ -36,10 +36,10 @@ lasd::StackVec generateRandomStackVecFloat(); lasd::StackVec generateRandomStackVecString(); template -void StackIntFunctions(T&); +void StackFunctions(T&); -template -void PushInt(T&); +template