can someone find whats wrong here?

This is my program

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
#include<iostream>
#include<fstream>
using namespace std;

char ch;
int x, y, num=0;
void rectangle (char, int, int);
void line (char, int);
void main ()
{
	ifstream fin; 
	fin.open ("\\users\\owen\\desktop\\animals.dat");
	char ch=fin.get();
	while(!fin.eof())
	{
		if(ch!=\n)
		x=ch-'a'+1;
		y++;
		rectangle(ch, x, y);
		line(ch, num);
		char ch=fin.get();
	}
	
	
}

void line (char ch, int num)
{ int i;
	for (i=1; i<=num; i++)
	cout<<ch;
	cout<<endl;
}

void rectangle( char ch, int x, int y)
{
    for(int i = 0; i < num; i++)
    {
        cout << endl;
        line( ch, num);
    }
}
Are you getting errors or something?
its not outputting anything
U are doing some non-standard and bad practices here :

Do not use global variables
main() should be int
U should not loop through eof()

Can you show what should be the output and what does animals.dat looks like
This is the animals.dat file
tiger
dog
racoon
zebra
aardvark
hippopotamus
cat

and it should print out
tttttttttttttttttttt

iiiiiiiii
iiiiiiiii

ggggggg
ggggggg
ggggggg

eeeee
eeeee
eeeee
eeeee

rrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrr



dddd

ooooooooooooooo
ooooooooooooooo

ggggggg
ggggggg
ggggggg



rrrrrrrrrrrrrrrrr
etc.etc.etc


and so on out professor said to loop through the file one char at a time and operating on to each on printing it out.
Topic archived. No new replies allowed.