Return a value

The error when i try to build my code says, 'createBanner' must return a value. But when i try to put return 0; at the end of my code, I get a huge long error.
Here is the last function of my code where I get my error
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
string createBanner(istream& in)
{
char c;
Letter message[256];
int counter=0;
in.get(c);

while(!in.fail()&&counter<256)
{
if(c=='A')
{
message[counter]=getA();
}
else if (c=='B')
message[counter]=getB();
else if (c=='C')
message[counter]=getC();
else if (c=='D')
message[counter]=getD();
else if (c=='E')
message[counter]=getE();
else if (c=='F')
message[counter]=getF();
else if (c=='G')
message[counter]=getG();
else if (c=='H')
message[counter]=getH();
else if (c=='I')
message[counter]=getI();
else if (c=='J')
message[counter]=getJ();
else if (c=='K')
message[counter]=getK();
else if (c=='L')
message[counter]=getL();
else if (c=='M')
message[counter]=getM();
else if (c=='N')
message[counter]=getN();
else if (c=='O')
message[counter]=getO();
else if (c=='P')
message[counter]=getP();
else if (c=='Q')
message[counter]=getQ();
else if (c=='R')
message[counter]=getR();
else if (c=='S')
message[counter]=getS();
else if (c=='T')
message[counter]=getT();
else if (c=='U')
message[counter]=getU();
else if (c=='V')
message[counter]=getV();
else if (c=='W')
message[counter]=getW();
else if (c=='X')
message[counter]=getX();
else if (c=='Y')
message[counter]=getY();
else if (c=='Z')
message[counter]=getZ();
else if (c==' ')
message[counter]=getSpace();
counter++;
in.get(c);
}
string banner = "";
int num = 0;
for (int j = 0; j<5; j++)
{
	for (int num = 0; num<256; num++)
	{
		for (int i=0; i<5; i++) 
		{
			banner += message[num].grid[j][i];
		}
		banner += " ";
	}

	banner += "\n";
	
}
}
Use void type for the return type... You're giving a reference as an argument, aren't you? so you're modifying your string directly, not by value, so you can use void...
What's the error and on which line?
It complains because you didn't return anything when the function signature says to return a string.

Can you post one of those fucntions you are calling? I'd like to see what they actually do because there has to be a much better way of designing your program than to have a separate function for each letter.
Topic archived. No new replies allowed.