using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace Palindrome
{
class Program
{
static void Main(string[] args)
{
string filePath = @"C:\Users\Me\Desktop\Palindromes\palindromes.txt";
//This gets the file we need
var meStack = new Stack<string>();
//this creates the stack
foreach (var item in File.ReadLines(filePath))
{
meStack.Push(item.ToUpper());
}
//for every item in the file, push onto the stack and make it upper case
while (meStack.TryPop(out string Line))
{
reverseMe(Line);
}
//While every line in the stack is popped out, every line goes to the fucntion reverseMe
static bool reverseMe(string Line)
{
return
Line == Line.Reverse();
}
//return true if line is the same as the line backwards or false if its not.
}
}
}
How do I get output? I have written comments to try and understand... but I am not getting a console output. I want the code to take in the file, put all the strings into a stack, and send every line in that stack to the reverseMe() function, which is a bool. The bool will see if the string is the same forward as it is backwards and if so it will return true or false. Basically my console is empty when I try to run this code.. What do I do?