TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sachith wickramaarachchi
NA
108
188.6k
Reverse String Using Stack c#
May 7 2016 12:38 PM
How can i reverse a string using stack,here is my code.But there have an error...please help me to fix this problem,thank you :)
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
namespace
ConsoleApplication1
{
class
Program
{
int
top;
int
[] stack =
new
int
[100];
public
void
pop()
{
Console.WriteLine(
"{0}"
, stack[top--]);
}
public
void
push(
char
x)
{
if
(top == 100 - 1)
{
Console.WriteLine(
"Stack is overflow"
);
}
else
{
stack[++top] = x;
}
}
public
void
Main()
{
string
word =
"Sri Lanka"
;
int
len = word.Length;
char
[] array = word.ToCharArray();
for
(
int
i = 0; i < len; i++)
{
push(array[i]);
}
for
(
int
i = 0; i < len; i++)
{
pop();
}
}
}
}
Reply
Answers (
3
)
how to solve it?????????????????????????????????????????????
I want to find column name in data table if exist do get the