Linked list implementation of array using c# console The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceHow do I calculate someone's age in C#?What is the difference between String and string in C#?Hidden Features of C#?Cast int to enum in C#How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?What are the correct version numbers for C#?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?How can I get the application's path in a .NET console application?Colors in JavaScript console

Huge performance difference of the command find with and without using %M option to show permissions

Is 'stolen' appropriate word?

Circular reasoning in L'Hopital's rule

Variable with quotation marks "$()"

What was the last x86 CPU that did not have the x87 floating-point unit built in?

Drawing vertical/oblique lines in Metrical tree (tikz-qtree, tipa)

Why did Peik Lin say, "I'm not an animal"?

Didn't get enough time to take a Coding Test - what to do now?

What other Star Trek series did the main TNG cast show up in?

Did the new image of black hole confirm the general theory of relativity?

Why doesn't shell automatically fix "useless use of cat"?

What's the point in a preamp?

What to do when moving next to a bird sanctuary with a loosely-domesticated cat?

Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?

Why not take a picture of a closer black hole?

Is there a way to generate uniformly distributed points on a sphere from a fixed amount of random real numbers per point?

How did the audience guess the pentatonic scale in Bobby McFerrin's presentation?

Keeping a retro style to sci-fi spaceships?

Working through the single responsibility principle (SRP) in Python when calls are expensive

Can a flute soloist sit?

Match Roman Numerals

My body leaves; my core can stay

Does Parliament need to approve the new Brexit delay to 31 October 2019?

Accepted by European university, rejected by all American ones I applied to? Possible reasons?



Linked list implementation of array using c# console



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceHow do I calculate someone's age in C#?What is the difference between String and string in C#?Hidden Features of C#?Cast int to enum in C#How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?What are the correct version numbers for C#?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?How can I get the application's path in a .NET console application?Colors in JavaScript console



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Hi i was wondering if anyone could help me. im stuck in a dead end here. I dont know how to make a peek and working pop function. i need assistance.



here is my code so far:



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp13

class Program




int nextFree;
int End;
int Start;

Names[] Stack;
Names steven = new Names();
Names jacques = new Names();
Names samantha = new Names();
Names lilly = new Names();




public struct Names

public Int32 pointer;
public string data;


static void Main(string[] args)


Program prog = new Program();
do

prog.DisplayMenu();

while (true);


public void DisplayMenu()

Int32 userInput = 0;

Console.WriteLine("Enter number of choice:");
Console.WriteLine("=======================");
Console.WriteLine("1: Sign up for consultation");
Console.WriteLine("2: Begin consultation");
Console.WriteLine("3: Enter room");
Console.WriteLine("4: Closing time");
Console.WriteLine("5: Exit");
userInput = Int32.Parse(Console.ReadLine());


switch (userInput)

case 1:
this.Push();
break;
case 2:
this.Pop();
break;





case 5:
System.Environment.Exit(1);
break;




public Program()

Stack = new Names[20];

steven.data = "Steven";
steven.pointer = 1;

jacques.data = "Jacques";
jacques.pointer = 2;

samantha.data = "Samantha";
samantha.pointer = 3;

lilly.data = "Lilly";
lilly.pointer = -1;




Stack[0] = steven;
Stack[1] = jacques;
Stack[2] = samantha;
Stack[3] = lilly;
nextFree = 4;
End = 20;
Start = 0;



public string Pop()


string value = string.Empty;

if (nextFree == -1)

Console.WriteLine("Stack is empty");
Console.ReadLine();

else


Names thisNode = Stack[End];
int temp = End;
End = thisNode.pointer;
thisNode.pointer = nextFree;
nextFree = temp;





this.ListAllNames();
return value;










public void Push()

if (nextFree >= Stack.Length)

Console.WriteLine("Stackoverflow, to many elements for the stack");
Console.ReadLine();

else

Console.WriteLine("Enter a name to be added");
string input = Console.ReadLine();
Stack[nextFree].data = input;
Stack[nextFree].pointer = End;
End = nextFree;
nextFree++;

this.ListAllNames();




public void ListAllNames()

foreach (Names name in Stack)

Console.WriteLine("Name:" + name.data);








as you can see it is unfinished. im at a standstill and cannot move one.
I have trouble in using the elements here so that i could make a function such as peek and pop properly.










share|improve this question

















  • 1





    I did a implementation mybe it helps codereview.stackexchange.com/questions/138142/linked-list-in-c

    – fubo
    Mar 8 at 12:21











  • The best would be to ask your mentor or teacher. Such kind of questions are too broad for SO, unless you can narrow it down to one problem, e.g. if something is not working and you explain what you want and what happens instead.

    – Sinatr
    Mar 8 at 12:29











  • Maybe this link might help you out: geeksforgeeks.org/implementing-stack-c-sharp

    – Alexandre Castro
    Mar 8 at 13:27











  • The Stack class already implements Push(), Pop() and Peek(), you should use it and not reinvent the wheel : docs.microsoft.com/en-us/dotnet/api/…

    – bN_
    Mar 8 at 13:36

















0















Hi i was wondering if anyone could help me. im stuck in a dead end here. I dont know how to make a peek and working pop function. i need assistance.



here is my code so far:



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp13

class Program




int nextFree;
int End;
int Start;

Names[] Stack;
Names steven = new Names();
Names jacques = new Names();
Names samantha = new Names();
Names lilly = new Names();




public struct Names

public Int32 pointer;
public string data;


static void Main(string[] args)


Program prog = new Program();
do

prog.DisplayMenu();

while (true);


public void DisplayMenu()

Int32 userInput = 0;

Console.WriteLine("Enter number of choice:");
Console.WriteLine("=======================");
Console.WriteLine("1: Sign up for consultation");
Console.WriteLine("2: Begin consultation");
Console.WriteLine("3: Enter room");
Console.WriteLine("4: Closing time");
Console.WriteLine("5: Exit");
userInput = Int32.Parse(Console.ReadLine());


switch (userInput)

case 1:
this.Push();
break;
case 2:
this.Pop();
break;





case 5:
System.Environment.Exit(1);
break;




public Program()

Stack = new Names[20];

steven.data = "Steven";
steven.pointer = 1;

jacques.data = "Jacques";
jacques.pointer = 2;

samantha.data = "Samantha";
samantha.pointer = 3;

lilly.data = "Lilly";
lilly.pointer = -1;




Stack[0] = steven;
Stack[1] = jacques;
Stack[2] = samantha;
Stack[3] = lilly;
nextFree = 4;
End = 20;
Start = 0;



public string Pop()


string value = string.Empty;

if (nextFree == -1)

Console.WriteLine("Stack is empty");
Console.ReadLine();

else


Names thisNode = Stack[End];
int temp = End;
End = thisNode.pointer;
thisNode.pointer = nextFree;
nextFree = temp;





this.ListAllNames();
return value;










public void Push()

if (nextFree >= Stack.Length)

Console.WriteLine("Stackoverflow, to many elements for the stack");
Console.ReadLine();

else

Console.WriteLine("Enter a name to be added");
string input = Console.ReadLine();
Stack[nextFree].data = input;
Stack[nextFree].pointer = End;
End = nextFree;
nextFree++;

this.ListAllNames();




public void ListAllNames()

foreach (Names name in Stack)

Console.WriteLine("Name:" + name.data);








as you can see it is unfinished. im at a standstill and cannot move one.
I have trouble in using the elements here so that i could make a function such as peek and pop properly.










share|improve this question

















  • 1





    I did a implementation mybe it helps codereview.stackexchange.com/questions/138142/linked-list-in-c

    – fubo
    Mar 8 at 12:21











  • The best would be to ask your mentor or teacher. Such kind of questions are too broad for SO, unless you can narrow it down to one problem, e.g. if something is not working and you explain what you want and what happens instead.

    – Sinatr
    Mar 8 at 12:29











  • Maybe this link might help you out: geeksforgeeks.org/implementing-stack-c-sharp

    – Alexandre Castro
    Mar 8 at 13:27











  • The Stack class already implements Push(), Pop() and Peek(), you should use it and not reinvent the wheel : docs.microsoft.com/en-us/dotnet/api/…

    – bN_
    Mar 8 at 13:36













0












0








0








Hi i was wondering if anyone could help me. im stuck in a dead end here. I dont know how to make a peek and working pop function. i need assistance.



here is my code so far:



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp13

class Program




int nextFree;
int End;
int Start;

Names[] Stack;
Names steven = new Names();
Names jacques = new Names();
Names samantha = new Names();
Names lilly = new Names();




public struct Names

public Int32 pointer;
public string data;


static void Main(string[] args)


Program prog = new Program();
do

prog.DisplayMenu();

while (true);


public void DisplayMenu()

Int32 userInput = 0;

Console.WriteLine("Enter number of choice:");
Console.WriteLine("=======================");
Console.WriteLine("1: Sign up for consultation");
Console.WriteLine("2: Begin consultation");
Console.WriteLine("3: Enter room");
Console.WriteLine("4: Closing time");
Console.WriteLine("5: Exit");
userInput = Int32.Parse(Console.ReadLine());


switch (userInput)

case 1:
this.Push();
break;
case 2:
this.Pop();
break;





case 5:
System.Environment.Exit(1);
break;




public Program()

Stack = new Names[20];

steven.data = "Steven";
steven.pointer = 1;

jacques.data = "Jacques";
jacques.pointer = 2;

samantha.data = "Samantha";
samantha.pointer = 3;

lilly.data = "Lilly";
lilly.pointer = -1;




Stack[0] = steven;
Stack[1] = jacques;
Stack[2] = samantha;
Stack[3] = lilly;
nextFree = 4;
End = 20;
Start = 0;



public string Pop()


string value = string.Empty;

if (nextFree == -1)

Console.WriteLine("Stack is empty");
Console.ReadLine();

else


Names thisNode = Stack[End];
int temp = End;
End = thisNode.pointer;
thisNode.pointer = nextFree;
nextFree = temp;





this.ListAllNames();
return value;










public void Push()

if (nextFree >= Stack.Length)

Console.WriteLine("Stackoverflow, to many elements for the stack");
Console.ReadLine();

else

Console.WriteLine("Enter a name to be added");
string input = Console.ReadLine();
Stack[nextFree].data = input;
Stack[nextFree].pointer = End;
End = nextFree;
nextFree++;

this.ListAllNames();




public void ListAllNames()

foreach (Names name in Stack)

Console.WriteLine("Name:" + name.data);








as you can see it is unfinished. im at a standstill and cannot move one.
I have trouble in using the elements here so that i could make a function such as peek and pop properly.










share|improve this question














Hi i was wondering if anyone could help me. im stuck in a dead end here. I dont know how to make a peek and working pop function. i need assistance.



here is my code so far:



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp13

class Program




int nextFree;
int End;
int Start;

Names[] Stack;
Names steven = new Names();
Names jacques = new Names();
Names samantha = new Names();
Names lilly = new Names();




public struct Names

public Int32 pointer;
public string data;


static void Main(string[] args)


Program prog = new Program();
do

prog.DisplayMenu();

while (true);


public void DisplayMenu()

Int32 userInput = 0;

Console.WriteLine("Enter number of choice:");
Console.WriteLine("=======================");
Console.WriteLine("1: Sign up for consultation");
Console.WriteLine("2: Begin consultation");
Console.WriteLine("3: Enter room");
Console.WriteLine("4: Closing time");
Console.WriteLine("5: Exit");
userInput = Int32.Parse(Console.ReadLine());


switch (userInput)

case 1:
this.Push();
break;
case 2:
this.Pop();
break;





case 5:
System.Environment.Exit(1);
break;




public Program()

Stack = new Names[20];

steven.data = "Steven";
steven.pointer = 1;

jacques.data = "Jacques";
jacques.pointer = 2;

samantha.data = "Samantha";
samantha.pointer = 3;

lilly.data = "Lilly";
lilly.pointer = -1;




Stack[0] = steven;
Stack[1] = jacques;
Stack[2] = samantha;
Stack[3] = lilly;
nextFree = 4;
End = 20;
Start = 0;



public string Pop()


string value = string.Empty;

if (nextFree == -1)

Console.WriteLine("Stack is empty");
Console.ReadLine();

else


Names thisNode = Stack[End];
int temp = End;
End = thisNode.pointer;
thisNode.pointer = nextFree;
nextFree = temp;





this.ListAllNames();
return value;










public void Push()

if (nextFree >= Stack.Length)

Console.WriteLine("Stackoverflow, to many elements for the stack");
Console.ReadLine();

else

Console.WriteLine("Enter a name to be added");
string input = Console.ReadLine();
Stack[nextFree].data = input;
Stack[nextFree].pointer = End;
End = nextFree;
nextFree++;

this.ListAllNames();




public void ListAllNames()

foreach (Names name in Stack)

Console.WriteLine("Name:" + name.data);








as you can see it is unfinished. im at a standstill and cannot move one.
I have trouble in using the elements here so that i could make a function such as peek and pop properly.







c# linked-list console implementation






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 12:19









Smith MorpheusSmith Morpheus

11




11







  • 1





    I did a implementation mybe it helps codereview.stackexchange.com/questions/138142/linked-list-in-c

    – fubo
    Mar 8 at 12:21











  • The best would be to ask your mentor or teacher. Such kind of questions are too broad for SO, unless you can narrow it down to one problem, e.g. if something is not working and you explain what you want and what happens instead.

    – Sinatr
    Mar 8 at 12:29











  • Maybe this link might help you out: geeksforgeeks.org/implementing-stack-c-sharp

    – Alexandre Castro
    Mar 8 at 13:27











  • The Stack class already implements Push(), Pop() and Peek(), you should use it and not reinvent the wheel : docs.microsoft.com/en-us/dotnet/api/…

    – bN_
    Mar 8 at 13:36












  • 1





    I did a implementation mybe it helps codereview.stackexchange.com/questions/138142/linked-list-in-c

    – fubo
    Mar 8 at 12:21











  • The best would be to ask your mentor or teacher. Such kind of questions are too broad for SO, unless you can narrow it down to one problem, e.g. if something is not working and you explain what you want and what happens instead.

    – Sinatr
    Mar 8 at 12:29











  • Maybe this link might help you out: geeksforgeeks.org/implementing-stack-c-sharp

    – Alexandre Castro
    Mar 8 at 13:27











  • The Stack class already implements Push(), Pop() and Peek(), you should use it and not reinvent the wheel : docs.microsoft.com/en-us/dotnet/api/…

    – bN_
    Mar 8 at 13:36







1




1





I did a implementation mybe it helps codereview.stackexchange.com/questions/138142/linked-list-in-c

– fubo
Mar 8 at 12:21





I did a implementation mybe it helps codereview.stackexchange.com/questions/138142/linked-list-in-c

– fubo
Mar 8 at 12:21













The best would be to ask your mentor or teacher. Such kind of questions are too broad for SO, unless you can narrow it down to one problem, e.g. if something is not working and you explain what you want and what happens instead.

– Sinatr
Mar 8 at 12:29





The best would be to ask your mentor or teacher. Such kind of questions are too broad for SO, unless you can narrow it down to one problem, e.g. if something is not working and you explain what you want and what happens instead.

– Sinatr
Mar 8 at 12:29













Maybe this link might help you out: geeksforgeeks.org/implementing-stack-c-sharp

– Alexandre Castro
Mar 8 at 13:27





Maybe this link might help you out: geeksforgeeks.org/implementing-stack-c-sharp

– Alexandre Castro
Mar 8 at 13:27













The Stack class already implements Push(), Pop() and Peek(), you should use it and not reinvent the wheel : docs.microsoft.com/en-us/dotnet/api/…

– bN_
Mar 8 at 13:36





The Stack class already implements Push(), Pop() and Peek(), you should use it and not reinvent the wheel : docs.microsoft.com/en-us/dotnet/api/…

– bN_
Mar 8 at 13:36












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55063121%2flinked-list-implementation-of-array-using-c-sharp-console%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55063121%2flinked-list-implementation-of-array-using-c-sharp-console%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved