1337 translator program (File I/O)

Here's the directions:
http://tinyurl.com/7b8yltp

Basically, you need to read in text from one file and output to another file, except translated to 1337. I have trouble understanding ifstream and such. This is what I have so far:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include <stdlib.h>
#include <fstream>

using namespace std;

int main(int argc, char *argv[])
{
  ifstream i("message.txt");
  ofstream o("Thomas_leet_message.txt");
  
  string s = "";
  string temp = "";
  while( !i.eof() ) //eof means end of file
  {

  for(int i=0; i<temp.length(); i++)
  {
   if
  
}
    // read in your whole message into s
    // concatinate word by word seperated by spaces and other punc marks
  }
 
 
 //do your translation here
 // Use my .exe as a guide to know what english letter translates to what lee7 letter
 
 
  
  i.close();
  o.close();
 // cout << s << endl;
 // system("PAUSE");	
  return 0;
}


Thanks for the help in advance.
I can't open the documents, and I don't quite understand the question. What do you mean by translated to 1337?
BUMP

You probably needed a Google account to view the directions.

Here they are:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
L337 Translator Program




Intro:
L337 ( or leet, or elite speak ) is a written form of internet slang – primarily used by online gamers and hackers. Leet Speak is a very basic form of encryption in the sense that English characters are written using 1 or more combination of characters. 
For example:
H in leet is |-|  . 
Notice how |-| uses 3 characters – but still appears to look like the H.
Another example:
Town   70\/\/|\|
For more info on L337 visit : http://en.wikipedia.org/wiki/L337

Instructions:
You are to write a C++ program that translates a text file “message.txt” to another text file “lastnameF_leet_message.txt”. You must use ifstream to read from “message.txt” and ofstream to write to “lastnameF_leet_message.txt”
Your program will have no user interface – which means the user of this program will not see any questions, instructions, or options. The user will not interact with your program at all. All the user will do is simply double-click on the executable, and the message will be translated.

Note: 
•	Your message filename must be “message.txt”
•	Your executable and “message.txt” must be in the same folder
•	Your translated file must be named “LastnameF_leet_message.txt”
 

Translation:
Since there are several ways to translate characters in L337 speak, use the table below as the standard for your program (for both capital and lower-case letters)

English	L337		English	L337
A	4		P	p
B	I3		Q	Q
C	(		R	r
D	D		S	$
E	3		T	7
F	pH		U	U
G	9		V	\/
H	|-|		W	\/\/
I	1		X	><
J	j		Y	'/
K	|<		Z	Z
L	L			
M	/\/\			
N	|\|			
O	0			


Hints/How to do it?
•	Store whole message into a string (using ifstream and .eof() )
•	Loop Through each character in the string and if it is one of the English Alphabet Letters, translate using table above



   
I'm not really sure I can help much short of giving you the answer, but here goes.

Run through the file and store each separate line in a string called "temp" then add it to a string called "message"

Use a switch to decide which letter of the alphabet each letter is, and translate the letters.

There's not much more I can do besides that. Post your code on here when you're done, I'd love to check it out.
Topic archived. No new replies allowed.