C or C++
I need to create a code with implementing stack using linked list(and should not use static array)
and for input, each line should be this following order form: name, id, and email
and for output, each line should be this order: id, name, and email
here is examples of text files
example1.txt
Geo, 10, [email protected]
Yoa, 13, [email protected]
Yon, 19, [email protected]
Cpo, 48, [email protected]
Apx, 55, [email protected]
example2.txt
Joh, 50, [email protected]
Jea, 20, [email protected]
Dav, 194, [email protected]
Chloe, 28, [email protected]
Chel, 17, [email protected]
#include <iostream>
int main()
{
// need to read from input files
// Implement stack class using linked list
return 0;
}
//C++ program
#include<iostream>
#include<fstream>
using namespace std;
class Node{
string name;
int id;
string email;
Node* below;
public:
Node(){
below=NULL;
}
Node(string name,int id,string
email , Node * b){
this->name =
name;
this->id=id;
this->email =
email;
below = b;
}
Node* getBelow(){
return
below;
}
string getName(){
return
name;
}
int getId(){
return id;
}
string getEmail(){
return
email;
}
};
class Stack{
Node * top;
int size;
public:
Stack(){
top=NULL;
size=0;
}
void push(string name,int id,string
email ){
top = new
Node(name,id,email , top);
size++;
}
bool isEmpty(){
return
top==NULL;
}
Node*peek(){
return
top;
}
void pop(){
Node *
temp=top;
top=top->getBelow();
delete
temp;
size--;
}
};
int main(){
ifstream in;
in.open("input.txt");
string name;
int id;
string email;
Stack s;
if(!in){
cout<<"File not
opened\n";
return 0;
}
while(!in.eof()){
in>>name;
in>>id;
in>>email;
s.push(name,id,email);
}
cout<<"\nstack content\n";
while(!s.isEmpty()){
Node*temp = s.peek();
cout<<temp->getName()<<",
"<<temp->getId()<<",
"<<temp->getEmail()<<"\n";
s.pop();
}
return 0;
}
//sample output
C or C++ I need to create a code with implementing stack using linked list(and should...
Using C Please comment » Part A: Stack Create a Stack struct that is a wrapper for your linked list o You should implement the following functions that take a stack o void push(Stack * stack, int value) ● int pop(Stack * stack) Prompt the user to input 5 integers, and use the stack to reverse the integers Print the result to the screen. o o » Part B: Queue o Create a Queue struct that is a wrapper for...
implementing the stack ADT with singly linked list Theoretical Questions, pot - Adobe Acrobat Reader DC File Edit View Sign Window Help Home Tools Theoretical Questio. * Sign In B6Q 0 175 20 } Search Reduce S70 } } Do Export PDF Adobe Export PDF Convert PDF Files to word Ortel Online Select Postile Theoretical..cons.pdt X Microsoft Word docu Programming Part (preferably using Java): 4. (75 marks) Implement the stack ADT with singly linked list (without using classes from any...
I NEED SOME HELP WITH THIS PLEASE :) 1. Create a data entry form on one of your web pages for visitors who want to be added to your mailing list. Include one of each of the following input elements*: Text <input type="text".... • Tel <input type="tel".... . Email <input type="email"... Date <input type="date"... . A set of radio buttons <input type="radio"... • A set of check boxes <input type="checkbox"... • A select element with options <select>.....</select> (do NOT add...
I need this in C++. This is all one question Program 2: Linked List Class For this problem, let us take the linked list we wrote in a functional manner in a previous assignment and convert it into a Linked List class. For extra practice with pointers we'll expand its functionality and make it a doubly linked list with the ability to traverse in both directions. Since the list is doubly linked, each node will have the following structure: struct...
Using Doubly Linked List, and Sorting methods: (In Java) (please attach your output with the answer) (Please answer if it is correct and working) (Have been getting many wrong and spam answers lately) Introduction: In this project, we use the same file structure of Artist and Art to extend the concepts of array and linked list and have them applied to sorting. The input files of p1arts.txt and p1artists.txt have been slightly modified. They are named p7arts.txt and p7artists.txt. Assignments:...
Need C programming help. I've started to work on the program, however I struggle when using files and pointers. Any help is appreciated as I am having a hard time comleting this code. #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_LINE 100 #define MAX_NAME 30 int countLinesInFile(FILE* fPtr); int findPlayerByName(char** names, char* target, int size); int findMVP(int* goals, int* assists, int size); void printPlayers(int* goals, int* assists, char** names, int size); void allocateMemory(int** goals, int** assists, char*** names, int size);...
Solve it for java Question Remember: You will need to read this assignment many times to understand all the details of the you need to write. program Goal: The purp0se of this assignment is to write a Java program that models an elevator, where the elevator itself is a stack of people on the elevator and people wait in queues on each floor to get on the elevator. Scenario: A hospital in a block of old buildings has a nearly-antique...