• Forum
  • Lounge
  • [Halloween]What is your serial killer na

 
[Halloween]What is your serial killer name?

Pages: 123
Yesterday, my wife stumbled upon this facebook image that had you look up your first letter of your first name and last letter of your last name to make a serial killer name in honor of the Dexter series. I got bored and wrote two console apps to do it for you (I was bored). I may learn Qt and make a Qt GUI app that has fields to type in and receive the name, or a button you press to continually get a new random name. Posting it here as I felt it was a better place for it. My code probably sucks and could have been done better, so don't be too harsh on it. Sorry for being late for Halloween.

Here is the picture: http://prntscr.com/21cnih

Here is the code for each.
Follows normal rules from picture:
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
/*	*****************************************
	*					*
	*	Find Your Serial Killer Name 	*
	* 					*
	* 	Thought up by Project Fandom    *
	*  	as a Dexter series appreciation.*
	* 	This follows the rules of the 	*
	* 	image I took it from.		*
	* 					*
	*  	Coded by BHXSpecter		*
	* 					*
	* 	Filename: serialkiller.cpp	*
	* 					*
	*****************************************	*/
 
 #include <iostream>
 #include <string>
 
 // function for getting the first serial killer name
 std::string firstName(std::string fName);
 
 // function for getting the last serial killer name 
 std::string lastName(std::string lName);
 
 
 int main()
 {
	 std::cout << "Enter your first name: ";
	 std::string frstName;
	 std::cin >> frstName;
	 std::cout << "Enter your last name: ";
	 std::string lstName;
	 std::cin >> lstName;
	 
	 std::string seral;
	 std::string killa;
	 
	 seral = firstName(frstName);
	 killa = lastName(lstName);
	 
	 std::cout << "Well, " << frstName << " " << lstName << ", \n" 
		   << "it appears your serial killer name is " 
                   << seral << " " << killa << "!!!" << std::endl;
	 
	 return 0;
 }
 
 std::string firstName(std::string fName){
	 std::string serial;
	
	 // get the first letter of the user's first name
	 switch(fName[0])
	 {
		 case 'a':
		 case 'A':
			serial =  "Back Alley";
			break;
		case 'b':
		case 'B':
			serial = "Railroad";
			break;
		case 'c':
		case 'C':
			serial = "Uptown";
			break;
		case 'd':
		case 'D':
			serial = "Bay Harbor";
			break;
		case 'e':
		case 'E':
			serial = "Circus";
			break;
		case 'f':
		case 'F':
			serial = "Carpool";
			break;
		case 'g':
		case 'G':
			serial = "Meat Locker";
			break;
		case 'h':
		case 'H':
			serial = "Flophouse";
			break;
		case 'i':
		case 'I':
			serial = "Igloo";
			break;
		case 'j':
		case 'J':
			serial = "Boxcar";
			break;
		case 'k':
		case 'K':
			serial = "Outback";
			break;
		case 'l':
		case 'L':
			serial = "Watchtower";
			break;
		case 'm':
		case 'M':
			serial = "Playground";
			break;
		case 'n':
		case 'N':
			serial = "Conservatory";
			break;
		case 'o':
		case 'O':
			serial = "Delicatessen";
			break;
		case 'p':
		case 'P':
			serial = "Beach House";
			break;
		case 'q':
		case 'Q':
			serial = "Backstage";
			break;
		case 'r':
		case 'R':
			serial = "Ice Truck";
			break;
		case 's':
		case 'S':
			serial = "Garage Sale";
			break;
		case 't':
		case 'T':
			serial = "Box Factory";
			break;
		case 'u':
		case 'U':
			serial = "Hangar";
			break;
		case 'v':
		case 'V':
			serial = "Swamp";
			break;
		case 'w':
		case 'W':
			serial = "Nursery";
			break;
		case 'x':
		case 'X':
			serial = "Strip Mall";
			break;
		case 'y':
		case 'Y':
			serial = "Octagon";
			break;
		case 'z':
		case 'Z':
			serial = "Kitchen";
			break;
		default:
			std::cout << "Sorry that isn't a letter." << std::endl;
			break;
	}
	
	return serial;
}

std::string lastName(std::string lName){
	std::string killer;
	int lastLetter = lName.length() - 1;
	
	// get the last letter of the user's last name
	switch(lName[lastLetter])
	{
		case 'a':
		case 'A':
			killer = "Strangler";
			break;
		case 'b':
		case 'B':
			killer = "Tickler";
			break;
		case 'c':
		case 'C':
			killer = "Slicer";
			break;
		case 'd':
		case 'D':
			killer = "Slasher";
			break;
		case 'e':
		case 'E':
			killer = "Stabber";
			break;
		case 'f':
		case 'F':
			killer = "Hacker";
			break;
		case 'g':
		case 'G':
			killer = "Smasher";
			break;
		case 'h':
		case 'H':
			killer = "Mangler";
			break;
		case 'i':
		case 'I':
			killer = "Flayer";
			break;
		case 'j':
		case 'J':
			killer = "Smotherer";
			break;
		case 'k':
		case 'K':
			killer = "Skinner";
			break;
		case 'l':
		case 'L':
			killer = "Pickler";
			break;
		case 'm':
		case 'M':
			killer = "Chomper";
			break;
		case 'n':
		case 'N':
			killer = "Butcher";
			break;
		case 'o':
		case 'O':
			killer = "Peeler";
			break;
		case 'p':
		case 'P':
			killer = "Disemboweler";
			break;
		case 'q':
		case 'Q':
			killer = "Cutter";
			break;
		case 'r':
		case 'R':
			killer = "Killer";
			break;
		case 's':
		case 'S':
			killer = "Asphyxiator";
			break;
		case 't':
		case 'T':
			killer = "Chef";
			break;
		case 'u':
		case 'U':
			killer = "Diner";
			break;
		case 'v':
		case 'V':
			killer = "Monster";
			break;
		case 'w':
		case 'W':
			killer = "Boiler";
			break;
		case 'x':
		case 'X':
			killer = "Pounder";
			break;
		case 'y':
		case 'Y':
			killer = "Collector";
			break;
		case 'z':
		case 'Z':
			killer = "Keeper";
			break;
		default:
			std::cout << "Sorry that isn't a letter.";
			break;
	}
	
	return killer;
}

Random name made:
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
/*	**********************************************
	*	Find your serial killer name	     *
	* 	This is based off the image I found  *
	* 	from Project Fandom for the Dexter   *
	*	series. Instead of enter your name,  *
	* 	it randomly picks both names and     *
	* 	prints them out for you.	     *
	* 					     *
	* 	Coded by BHXSpecter		     *
	* 					     *
	* 	File: ranserkill.cpp		     *
	* 					     *
	**********************************************	*/

#include <iostream>
#include <cstdlib>
#include <ctime>

int main()
{
	srand(time(NULL));
	
	std::string serial[26] = { "Back Alley", "Railroad", "Uptown", "Bay Harbor",
"Circus", "Carpool", "Meat Locker", "Flophouse", "Igloo", "Boxcar",
"Outback", "Watchtower", "Playground", "Conservatory", 
"Delicatessen", "Beach House", "Backstage", "Ice Truck", "Garage Sale",
"Box Factory", "Hangar", "Swamp", "Nursery", "Strip Mall", "Octagon", 
"Kitchen" };
			
	std::string killer[26] = { "Strangler", "Tickler", "Slicer", "Slasher", 
"Stabber", "Hacker", "Smasher", "Mangler", "Flayer", "Smotherer", 
"Skinner", "Pickler", "Chomper", "Butcher", "Peeler", "Disemboweler", "Cutter",
 "Killer", "Asphyxiator","Chef", "Diner", "Monster", "Boiler", "Pounder",
 "Collector", "Keeper" };
			
	int first = rand() % 26;
	int last = rand() % 26;
	
	std::cout << "Your random serial killer name is " 
                  << serial[first] << " " << killer[last] << "!" << std::endl;
	
	return 0;
}
Last edited on by closed account z6A9GNh0
Is it just me, or would kitchen chef be a pretty poor killer name? Beach house collector sounds like some rather rich acquaintances and box factory collector sounds like the least interesting job in the world!

My result: Playground chef
My result: Back alley skinner.

...how did it know? >_>

-Albatross
Yeah we had fun and did it the right way and some variants.
First letter of first name or middle name; first or last letter of last name

so our results are:
Regular:

Me: Uptown Killer
Wife: Swamp Killer
Son: Uptown Killer

Variants: first letter of middle name, and last letter of last name
Me: Circus Killer
Wife: Outback Killer
Son: Playground Killer

Variants: first letter of last name with the above variants
Me: Uptown Boiler or Circus Boiler
Wife: Swamp Boiler or Outback Boiler
Son: Uptown Boiler or Playground Boiler

I'm such a dork that I started saying we were the Triad Boilers composed of the Uptown Boiler, Outback Boiler, and Playground Boiler.
Looks pretty cool. Can I use it?
That literally took me about twenty minutes total to punch up both codes. The idea I took from is from Project Fandom. That was two of the simplest programs to write. Even a beginner could have wrote it, so why are you wanting to use it? The challenge for me will be learning Qt to write the GUI alternatives to those.
So I can see my name...
I posted the picture from Project Fandom, which I'm not a part of. The first app is just a program that does what the image was designed to do. The second one just chooses each section at random. Since it isn't my idea and I posted both codes, I can't really say no to someone else using it :P.
Oh, thanks. I'll post my result later.
Last edited on
Well, assuming your name on your profile is your first and last name, then your result will be "Back Alley Collector". :P
Lol. That's my actual name in real life.

I just sound like a hobo. (I was actually a hobo for Halloween.)
Playground Chomper :S
closed account (S6k9GNh0)
Kitchen Pickler
Quite fitting...

EDIT: BHXSpecter, btw you can use those tables you created in the random name made snippet to remove the switch in the original code. Tables are you friend for linear offsets. :D
Last edited on
@computerquip
I know, but really didn't see it saving much work. I could have done the list, but then I still would have needed the switch, and instead of setting serial and killer to the string literals I would have had to return each element of the array. Really wouldn't have saved me anything.
closed account (S6k9GNh0)
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
#include <iostream>
#include <cstdlib>
#include <ctime>

const std::string serial[26] = { 
    "Back Alley", "Railroad", "Uptown", "Bay Harbor",
    "Circus", "Carpool", "Meat Locker", "Flophouse", "Igloo", "Boxcar",
    "Outback", "Watchtower", "Playground", "Conservatory", 
    "Delicatessen", "Beach House", "Backstage", "Ice Truck", "Garage Sale",
    "Box Factory", "Hangar", "Swamp", "Nursery", "Strip Mall", "Octagon", 
    "Kitchen" 
};
			
const std::string killer[26] = { 
    "Strangler", "Tickler", "Slicer", "Slasher", 
    "Stabber", "Hacker", "Smasher", "Mangler", "Flayer", "Smotherer", 
    "Skinner", "Pickler", "Chomper", "Butcher", "Peeler", "Disemboweler", "Cutter",
    "Killer", "Asphyxiator","Chef", "Diner", "Monster", "Boiler", "Pounder",
    "Collector", "Keeper" 
};

std::string get_input(const std::string& what) {
	std::string input;
	bool bGood = false;
	
	while (bGood == false) {
		std::cout << "Enter " << what << ": ";
		std::getline(std::cin, input);
		
		input[0] = ::tolower(input[0]);
		
		if (input[0] < 'a' || input[0] > 'z') {
			std::cout << "Invalid name. Please try again." << std::endl;
		}
		else bGood = true;
	}
	
	return input;
}

int main()
{
    std::string first = get_input("first name");
    std::string last = get_input("last name"); 

    /* The following completely replaces your switch statement using tables and offsets (also a bit faster). */
    std::cout << 
        serial[first[0] - 'a'] 
        << " " << 
        killer[last[0] - 'a'] 
        << std::endl;
 
    return 0;
}


EDIT: No need to change entire string just for the first letter of each name...
EDIT2: Glorious functions!
Last edited on
Nice, but you goofed on two things. One is personal preference, and the other is a misread on the rules.

1) I personally would have avoided the global array of strings.
2) It is supposed to be the last letter of the last name.
closed account (S6k9GNh0)
Oh your right. I did misread...

As for globals, globals aren't as evil as people claim. In this case, our tables are constant meaning they'll never change. Because we have this assurance, it's safe to use these tables even in a more complicated threaded environment (which we don't anyways).

EDIT: My name is actually Kitchen Slasher :D

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
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <algorithm>

const std::string serial[26] = { 
    "Back Alley", "Railroad", "Uptown", "Bay Harbor",
    "Circus", "Carpool", "Meat Locker", "Flophouse", "Igloo", "Boxcar",
    "Outback", "Watchtower", "Playground", "Conservatory", 
    "Delicatessen", "Beach House", "Backstage", "Ice Truck", "Garage Sale",
    "Box Factory", "Hangar", "Swamp", "Nursery", "Strip Mall", "Octagon", 
    "Kitchen" 
};
			
const std::string killer[26] = { 
    "Strangler", "Tickler", "Slicer", "Slasher", 
    "Stabber", "Hacker", "Smasher", "Mangler", "Flayer", "Smotherer", 
    "Skinner", "Pickler", "Chomper", "Butcher", "Peeler", "Disemboweler", "Cutter",
    "Killer", "Asphyxiator","Chef", "Diner", "Monster", "Boiler", "Pounder",
    "Collector", "Keeper" 
};

int main()
{
	std::string input;
	bool bGood = false;
	
	while (bGood == false) {
		std::cout << "Enter your name: ";
		std::getline(std::cin, input);
		
		{
			int space_count = 0;
			for (std::string::iterator it = input.begin(); it != input.end(); ++it) {
				if ((*it) == ' ') ++space_count;
			}
			
			if (space_count < 1) {
				std::cout << "Only one name entered. Enter first and last." << std::endl;
				continue;
			}
		}
		
		std::transform(input.begin(), input.end(), input.begin(), ::tolower);
		
		if ((input.front() < 'a' || input.front() > 'z') && input.back() < 'a' || input.back() > 'z') {
			std::cout << "Invalid name. Please try again." << std::endl;
		}
		else bGood = true;
	}

    std::cout << 
        serial[input.front() - 'a'] 
        << " " << 
        killer[input.back() - 'a'] 
        << std::endl;
}
Last edited on
Yeah, const globals I don't have a problem with. It is the globals that can be accidentally changed that I try to avoid. Your way is definitely less code, but I would never have thought of that way of doing it. I really haven't touched algorithm header file that much outside of sort() I think.
To his colleagues, CHRIS NAME is little more than a successful chef at a renowned upmarket restaurant in west London. But to the police, he's a vicious killer who expertly carves the finest cuts of meat from his human victims. Can they catch him before more people fry?

UPTOWN CHEF

Waiter, there's a face in my soup.

In cinemas now.

Based on a true story.
Last edited on
That made me laugh. That was a good one chrisname.
Pages: 123