Print out Letters

Pages: 12
well first you can stop the repeat by setting the value of i to 1.

As for the rest... now you have got me playing around with your code and if I work it out I will post it.
Manga don't worry about it anymore :D I have the whole code working now :) appreciate for your response though :)
Well, I just got it working myself... but glad you figured it out also.

For anyone else who was curious here is my solution...

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

void printout ( string &sentence, const string letters[46][5]) {
	
	int length=sentence.length();
	int row=0;
	int column=0;
	int i=0;
	char store_onechar_from_string;
	for(column=0; column<5;column++) {
	for (i=0;i<length;i++) {
		store_onechar_from_string = sentence[i];
		switch(store_onechar_from_string) {

		case 'a':
		    cout<<letters[0][column];
		    if(i==length-1){
				cout << endl;
			}
		  break;
		case 'A':
		    cout<<letters[0][column];
			if(i==length-1){
				cout << endl;
			}
		  break;
		case 'b':
		    cout<<letters[1][column]; 
			if(i==length-1){
				cout << endl;
			}
		  break;
		case 'B':
		    cout<<letters[1][column];
			if(i==length-1){
				cout << endl;
			}
		  break;
		default: cout << "Error";
		}
	  }//switch
	}
}//for column 

int main() {
	//Image of alphabets
const string letters[46][5]={
	{				
"    ____    ", //00						
"   /  _ \\   ", //01
"  /  /_\\ \\  ",
" /    |   \\ ",
" \\____|___/ "},

    {
"_________  ",
"\\   __   \\ ",
" | |__| _/ ",
" | |__|  \\ ",
"/________/ "}, 


};
string sentence;
cin>>sentence;

printout(sentence, letters);


cin.ignore(100, '\n');
cin.get();
	return 0;
}
Manga have been busy lately so didn't have the time to thank you. I did like your idea especially the use of the switch structure :D The one I made unfortunately was a tad long :D Wish I had thought of using something like this. Thank you though! :)
Topic archived. No new replies allowed.
Pages: 12