Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 14-10-2009
Member
 
Join Date: Aug 2009
Posts: 36
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?
Reply With Quote
  #2  
Old 14-10-2009
Member
 
Join Date: May 2008
Posts: 2,293
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.
Reply With Quote
  #3  
Old 14-10-2009
Member
 
Join Date: Jan 2009
Posts: 199
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.
Reply With Quote
  #4  
Old 14-10-2009
Member
 
Join Date: Dec 2008
Posts: 177
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].
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Random Function to Concatenate 2 strings"
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


All times are GMT +5.5. The time now is 08:42 PM.