Who Will You Kiss
Seçkin Üye
TR-Herkese merhaba bu random karekterlerle farklı farklı random isimler üretmenize yarayan ufak bir cod
EN-Hello everyone, this is a small cod that allows you to generate different random names with random characters.
EN-Hello everyone, this is a small cod that allows you to generate different random names with random characters.
Bağlantıları görmek için lütfen
Giriş Yap
C++:
#include <iostream>
#include <vector>
#include <iomanip>
#include <stdlib.h>
using namespace std;
string randomName(int length) {
char consonents[] = { 'b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','z' };
char vowels[] = { 'a','e','i','o','u','y' };
string name = "";
int random = rand() % 2;
int count = 0;
for (int i = 0; i < length; i++) {
if (random < 2 && count < 2) {
name = name + consonents[rand() % 19];
count++;
}
else {
name = name + vowels[rand() % 5];
count = 0;
}
random = rand() % 2;
}
return name;
}
int main() {
std::cout << " __ __ _ _ _ " << endl;
std::cout << "| \/ |___ _ __ ___ _ _ _ _| || |__ _ __| |_____ _ _ ___" << endl;
std::cout << "| |\/| / -_) ' \/ _ \ '_| || | __ / _` / _| / / -_) '_(_-<" << endl;
std::cout << "|_| |_\___|_|_|_\___/_| \_, |_||_\__,_\__|_\_\___|_| /__/" << endl;
std::cout << " |__/ " << endl;
int length;
cin >> length;
cout << randomName(length) << endl;
return 0;
}
Son düzenleme: