Im Confused

I need to write two functions and a main body program that will output the names of animals into block letters. example: CAT would output like this.
CCC

A
A

TTTTTTTTTTTTTTTTTTTT
TTTTTTTTTTTTTTTTTTTT
TTTTTTTTTTTTTTTTTTTT

My code is outputting this:

012F138E
012F138E
012F138E

Like the title says, Im confused. Please take a look and steer me in the right direction. Thank You!

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

ofstream fout;
ifstream fin;

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)
{
	int i=0;
	while(i<=y)
	{
		i++;
		fout<<x<<"\n";
	}
}

void main()
{
	char ch;
	int i=0; int num;

	fin.open("Animals.dat");
	fout.open("Animals_Output.dat");
	fin.get(ch);
	num=ch;

	while(!fin.eof())
	{
		if(ch!='\n')
		{
			i++;
			i=num;
			fout<<rectangle<<endl<<endl;
		}
		else
		{
			i++;
			fout<<endl<<endl<<endl<<endl;
		}
		fin.get(ch);
	}
}
Line 42 fout<<rectangle<<endl<<endl; will output the address of the function rectangle.

Instead of doing that, you need to call the function. You do that something like this:
rectangle('A' , 3, 5);
or
rectangle(ch, i, 0);
where you pass appropriate values for the three parameters ch, x and y. (Though I don't know what values you need to supply for x and y).

Note, that would be the complete statement. you don't need to put fout or anything else, because the function does its own output at line 22.
function rectangle printed the data to the file, and instead of trying to print to the file in main() i should have called function rectangle and passed the values. i get it now. Thank You for pointing me in the right direction.
Topic archived. No new replies allowed.