Loop/ifstream getline problem (rather urgent)

For some reason this loop only reads and executes the program for the first line of the text file. How can I read all four lines? I know it's easy but I just can get it :(
Any and all help is appreciated.
Thanks.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
do {
			cin.ignore();
			getline (infile,input);
			string output = "";
			for(int x = 0; x < input.length(); x++) {
			
            output += cipher(input[x]);
			}
			cout<<output<<endl;
			outfile<<output;
			system ("pause");
			return a;
			}
			while(getline(infile, line)); 
Why are you doing a return at line 12?
That will exit out of whatever function you're in and will never get to the while at line 14.
Okay
I changed it to this.
Still reads one line.
1
2
3
4
5
6
7
8
9
10
11
12
13
while(getline(infile, input)) {
			cin.ignore();
			getline (infile,line);

			string output = "";
			for(int x = 0; x < input.length(); x++) {
			
            output += cipher(input[x]);
			}
			cout<<output<<endl;
			outfile<<output;
			
			}
Topic archived. No new replies allowed.