10-28-2010, 12:04 AM
Alright so long story short I am extremely new to this and refuse to cheat so throw hints at me not answers. This should be super easy, here is the assignment.
I have a .txt file that is named "DecodeThis.txt" It's simply a .txt with the words backwards. So I know I need to read this file and then flip it using Array.Reverse. I don't know how and when to apply this though. So here is what I have so far.
I just don't know how to apply the arrays..
Not sure if that's right and I'm not sure where to put it..
Any tips that aren't answers?
--EDIT--
Alright here is the closest I've gotten but it's still wrong.
I have a .txt file that is named "DecodeThis.txt" It's simply a .txt with the words backwards. So I know I need to read this file and then flip it using Array.Reverse. I don't know how and when to apply this though. So here is what I have so far.
Spoiler (Click to View)
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Homework_Day_2
{
class Program
{
static void Main(string[] args)
{
StreamReader myReader = new StreamReader("DecodeThis.txt");
String line = "";
while (line != null)
{
line = myReader.ReadLine();
if (line != null)
Console.WriteLine(line);
}
myReader.Close();
Console.ReadLine();
}
}
}
I just don't know how to apply the arrays..
Spoiler (Click to View)
Quote:
string myReader???? = "???????";
char[] charArray = myReader??.ToCharArray();
Array.Reverse(charArray);
Console.WriteLine(charArray);
Not sure if that's right and I'm not sure where to put it..
Any tips that aren't answers?
--EDIT--
Alright here is the closest I've gotten but it's still wrong.
Spoiler (Click to View)
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Homework_Day_2
{
class Program
{
static void Main(string[] args)
{
StreamReader myReader = new StreamReader("DecodeThis.txt");
String line = "";
while (line != null)
{
line = myReader.ReadLine();
if (line != null)
Console.WriteLine(line);
}
string Streamreader = ("DecodeThis.txt");
char[] charArray = myReader.ToCharArray();
Array.Reverse(charArray);
Console.WriteLine(charArray);
myReader.Close();
Console.ReadLine();
}
}
}