|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Random Function to Concatenate 2 strings I have a problem for the creation of my program, here's what I'd like to do: cVar1 char = 0; cVar2 char = 0; cVar3 char = 0; cVar4 char = 0; The name comes from a scanf which wants and now it does this: cVar1 char = a; char cVar2 = b; cVar3 char = c; char cVar4 = d; how can they repeated on both lines at random? |
#2
| |||
| |||
Re: Random Function to Concatenate 2 strings What you want to do: the user enters two strings, and you mix all the characters and redistributed at random from the 2 channels, right? If so, I advise you to consider the function ran () "and the modulo operator (%). Basically ran function generates a random number and the% operator can transform into a number small enough to serve as an index of your chain. |
#3
| |||
| |||
Re: Random Function to Concatenate 2 strings To concatenate a string, remember that strings are basically arrays of characters.If you have string1 = "dot1" and string2 = "dot2". To concatenate 2 strings you can use simbol +. So, string1 + string2 will be one string. |
#4
| |||
| |||
Re: Random Function to Concatenate 2 strings The cVar1 = a, and% s is not set, It should be an array (cVar1 [100] for example). Then you must use the ran and the module. Personally I'd make a 2D array. You put your sentences in cvar [0], cvar [1], cvar [2], cvar [3] and you display them like that cvar [rand ()% 4]. |
![]() |
|
Tags: coordinates, function, integer |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Generate some quality of random number via Random Number Generation function | aMADeO! | Windows Software | 4 | 13-01-2012 05:07 PM |
Strings function in MySQL | Dino M | Software Development | 6 | 09-12-2010 04:01 AM |
StackOverflow Error and Random function | Trini Alvarado | Software Development | 5 | 11-03-2010 01:49 PM |
Function for two random numbers | Zool | Software Development | 3 | 03-12-2009 12:39 PM |
Create a function for comparing character strings | Zool | Software Development | 3 | 16-10-2009 01:09 PM |