-
Programa em C para converter texto para maiusculas aleatoriamente
Enviado em 16 Janeiro, 2010 2 comentáriosNão tinha nada para fazer e então fiz em C um programa que converte aleatoriamente minusculas para maiusculas.
Texto: ola. este é um teste
ola. EsTe é Um teSteE também converte aleatoriamente S para Z ou X; C para Q ou K.
É um programa useless, mas foi feito porque sim!
/* This program is free software. It comes without any warranty, to * the extent permitted by applicable law. You can redistribute it * and/or modify it under the terms of the Do What The Fuck You Want * To Public License, Version 2, as published by Sam Hocevar. See * http://sam.zoy.org/wtfpl/COPYING for more details. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <ctype.h> int main() { system("cls"); srand(time(NULL)); char texto[200], letraS[2] = {'x', 'z'}, letraC[2] = {'k', 'q'}; int i, qts = 0, num[150], troca, letra; printf("\t\t> MC Fuckin Palim Text Converter 0.1-mc <\n\n"); printf("- Para terminar basta fechar o programa.\n\n"); while (1) { fflush(stdin); printf("Texto: "); gets(texto); fflush(stdin); for (i = 0; i < strlen(texto) / 3; i++) { num[i] = rand() % strlen(texto) + 1; if (texto[num[i]] == ' ') { while (texto[num[i]] == ' ') num[i] = rand() % strlen(texto); } switch (texto[i]) { case 's': troca = rand() % 2; if (troca) { letra = rand() % 2; texto[i] = letraS[letra]; } break; case 'c': troca = rand() % 2; if (troca && texto[i + 1] != 'h') { letra = rand() % 2; texto[i] = letraC[letra]; } break; } qts++; } for (i = 0; i < qts; i++) texto[num[i]] = toupper(texto[num[i]]); puts(texto); texto[0] = '\0'; qts = 0; } }
2 comentários para “Programa em C para converter texto para maiusculas aleatoriamente”

-
Lol eu sei para que é isto
Deixar um comentário
-
amgarcia.net
Blog pessoal

Darkchild Heartly 21 Janeiro, 2010 às 05:05