Jump to content

Recommended Posts

Posted

With this code you can make a Random Name Generator

 

One of my friends ask me how he can do this and i make this code to help you make your own.

 

Here is the code :

 

/*
* File: main.c
* Author: Reap3R
*
* Created on September 3, 2012, 1:10 AM
*/

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h> //Needed for strcat()
#include <ctype.h>
//Here I will create an array of prefixes to help generate names.
// I am banking on multiplication to ensure a large number of names
// by using 7 prefixes and 20 stems, and 16 suffixes I should be able to
// create about 7 * 20 * 16 = 2240 names out of 312 bytes of data (In my earlier
// example from the forum I used this code to generate male and female names,
// but here I combined them).
char NamePrefix[][5] = {
"", //who said we need to add a prefix?
"bel", //lets say that means "the good"
"nar", //"The not so good as Bel"
"xan", //"The evil"
"bell", //"the good"
"natr", //"the neutral/natral"
"ev", //Man am I original
};

char NameSuffix[][5] = {
"", "us", "ix", "ox", "ith",
"ath", "um", "ator", "or", "axia",
"imus", "ais", "itur", "orex", "o",
"y"
};

const char NameStems[][10] = {
"adur", "aes", "anim", "apoll", "imac",
"educ", "equis", "extr", "guius", "hann",
"equi", "amora", "hum", "iace", "ille",
"inept", "iuv", "obe", "ocul", "orbis"
};

//Declare the function up here so that we can use it
// note that it does not return a value, rather it
// edits the character passed to it by reference.
void NameGen(char *PlayerName);
char get_Char(void); //little utility function to make getting char input easer...

int main()
{
char Player1Name[21]; //Used to hold our character's name
char cIn; //Used to get user answers to prompts.
srand((long)time(NULL)); //Seed the random number generator...
do
{
NameGen(Player1Name);
printf("Generated Name: %s\n\n", Player1Name);
puts("Would you like to generate another (Y,N): ");
cIn = get_Char();
} while (cIn != 'n' && cIn != 'N');

return 0;
}

//Utility function for input
char get_Char(void)
{
char cIn;
while((cIn = getchar()) return cIn;
}

//The return type is void because we use a pointer to the array holding
// the characters of the name.
void NameGen(char* PlayerName)
{
PlayerName[0]=0; //initialize the string to "" (zero length string).
//add the prefix...
strcat(PlayerName, NamePrefix[(rand() % 7)]);
//add the stem...
strcat(PlayerName, NameStems[(rand() % 20)]);
//add the suffix...
strcat(PlayerName, NameSuffix[(rand() % 16)]);
//Make the first letter capital...
PlayerName[0]=toupper(PlayerName[0]);
return;
}

 

Compile and Run

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • L2 WARFRONT - INTERLUDE FACTION PvP GRAND OPENING: 30 OCTOBER 2026 | 18:00 UTC    ANGELS VS DEMONS. TWO FACTIONS. ONE WAR. Tired of joining another Interlude server just to spend weeks farming before you can enjoy real PvP? L2 WARFRONT is a heavily customised Lineage 2 Interlude C6 Good vs Evil (GvE) server, built around continuous faction warfare, meaningful objectives and character progression through PvP. Our goal is simple: bring back the excitement of classic Interlude PvP while offering something different from the usual private server experience. CLOSED BETA COMPLETED - 110 PLAYERS PARTICIPATED! Our Closed Beta launched on 3 October, with 110 players. Players experienced real faction battles, tested class balance and helped us identify improvements before Grand Opening. We've listened to the feedback and are continuing to polish the experience for 30 October. Watch actual WARFRONT Closed Beta gameplay: https://www.youtube.com/watch?v=N09KbyAagh0 No cinematic trailers pretending to be gameplay. See the real fights for yourself! SERVER FEATURES FACTION WARFARE Angels vs Demons - two opposing factions Level 80 start with free starter equipment Approximately 25-minute rotating faction battles Moving frontline with capturable outposts Capture the Main Outpost and assault the enemy HQ Strategic respawn locations and battlefield objectives PvP-based rewards and progression MINI AND GRAND EVENTS 1v1, 2v2, 3v3 and 5v5 battles Team vs Team Capture the Flag King of the Hill Chaos and Deathmatch Daily Dion Faction Siege Weekly Giran Clan Siege Grand Boss faction battles Ranked 1v1 Olympiad CUSTOM PROGRESSION Character Mastery Gear Battle XP and equipment progression Battle Pass Custom class and faction balancing PvP rewards and achievements Clan recruitment system   BRING YOUR CLAN! Clan preregistration is already available through our Discord. Eligible preregistered clans can benefit from our special level 8 clan-start promotion. Whether you're coming with an organized clan, a few old friends or completely solo, there will be a place for you in the war. GRAND OPENING FRIDAY, 30 OCTOBER 2026 18:00 UTC / 21:00 MOSCOW Website: https://l2warfront.com Account Registration: https://l2warfront.com/register.html Discord: https://discord.gg/BGt5bfkrTw Closed Beta Gameplay: https://www.youtube.com/watch?v=N09KbyAagh0 Classic Interlude combat, completely reimagined around faction warfare. See you on the battlefield!
    • ⛔ 🔥 YOUR ISSUE DATE IS MATHEMATICALLY IMPOSSIBLE 🎂 On most US DLs the expiry lands on the holder's birthday. Not "around the same time" – exactly on the DOB. Month-day format, not day-month. 03/07 means March 7, not July 3. Mix up the order and you've birthed a date that never existed. Every template revision has a fixed revision date. On a 2012 California DL it's identical on all of them. Your own date – flag. Dates must chain: ISS plus term equals EXP. Break one link and the whole timeline is false. The machine checks arithmetic before it reads the name. 🐎 We verify dates against the state's official documentation before delivery. ✉️ US DL failing on flat ground? Send it – we'll audit the entire timeline. › TG: @mustang_service_ms ( https:// t.me/ mustang_service_ms ) › Channel: Mustang Service ( https:// t.me/ +JPpJCETg-xM1NjNl ) #drawing #kyc #photoshop #DL #dates
    • 🔥⚔️ LINEAGE 2 REBORN SIGNATURE – CHARACTERS & ADENA FOR SALE! ⚔️🔥 💎 CHARACTERS FOR SALE ✨ Eva’s Saint – Level 78 👑 Noblesse ⚔️ Subclass: Titan 💰 Price: €500 🔥 Archmage 👑 Noblesse ⚔️ Subclass: Destroyer (Destro) – Level 75 💰 Price: €400 💰 ADENA FOR SALE 🪙 1 Billion Adena = €250 📌 Server: L2Reborn Signature 📩 WTS – Want to Sell! Interested in any of these offers? Don't hesitate to contact me! 📬 DM me for more detailed information, screenshots, and serious inquiries. ⚔️ Choose your character, boost your gameplay, and make your next move on L2Reborn Signature! 🔥 #Lineage2 #L2Reborn #L2RebornSignature #EvaSaint #Archmage #Titan #Destro #AdenaForSale #WTS
    • can u release  clean  system folder for Samurai Crow??
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..