- #1
4102
- 7
- 0
1. Homework Statement
Hi I'm using C and I need to use arrays on this one, but I need to somehow randomize the output.2. Homework Equations
for example an output "abcde" could also have an output "bcade" possible
3. The Attempt at a Solution
#include <stdio.h>
main()
{
char word[27] = "abcdefghijklmnopqrstuvwxyz";
printf("The contents of word[] is %c%c%c\n", word[0], word[1], word[3]);
}
the output of these one is "abc", but I want it to randomize it without rearranging the order of the output. In every run of the program, the order of the output should be diferent
example for every run, the output would be "bac" or "cba" etc.
Thanks!
Hi I'm using C and I need to use arrays on this one, but I need to somehow randomize the output.2. Homework Equations
for example an output "abcde" could also have an output "bcade" possible
3. The Attempt at a Solution
#include <stdio.h>
main()
{
char word[27] = "abcdefghijklmnopqrstuvwxyz";
printf("The contents of word[] is %c%c%c\n", word[0], word[1], word[3]);
}
the output of these one is "abc", but I want it to randomize it without rearranging the order of the output. In every run of the program, the order of the output should be diferent
example for every run, the output would be "bac" or "cba" etc.
Thanks!