Download code/train/C++/0028086_StacksDP.cpp from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/code/train/C%2B%2B/0028086_StacksDP.cpp
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/code/train/C++/0028086_StacksDP.cpp
-
curl -L -o 0028086_StacksDP.cpp https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/code/train/C%2B%2B/0028086_StacksDP.cpp
1.34 kB
| using std::string; | |
| using std::cin; | |
| using std::cout; | |
| using std::stringstream; | |
| using namespace std; | |
| class StacksDP | |
| { | |
| private: | |
| Nodo *FirstNode, *tempNode; | |
| public: | |
| string push(string info){ | |
| if(FirstNode == NULL){ | |
| FirstNode = new Nodo(info); | |
| FirstNode->setNext(NULL); | |
| return "Exitosamente Guardado: "+info; | |
| } | |
| else{ | |
| tempNode = FirstNode; | |
| FirstNode = new Nodo(info); | |
| FirstNode->setNext(tempNode); | |
| return "Exitosamente Guardado: " + info; | |
| } | |
| } | |
| string pop(void){ | |
| if (FirstNode == NULL) { | |
| return "EMPTY LIST"; | |
| } | |
| string result = FirstNode->getString(); | |
| FirstNode = FirstNode->getNext(); | |
| return result; | |
| } | |
| string desplegar(void){ | |
| string result =""; | |
| if (FirstNode == NULL) { | |
| return "NULL LIST"; | |
| } | |
| Nodo *cursor = FirstNode; | |
| while(cursor!=NULL){ | |
| result += cursor->getString() +"\n"; | |
| cursor = cursor->getNext(); | |
| } | |
| return result; | |
| } | |
| void getData(void); | |
| void saveData(void); | |
| }; | |