fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <time.h>
  5.  
  6. main(){
  7. char valid_chars[27];
  8.  
  9. char mat_cript[10][10];
  10. char frase[10];
  11.  
  12. srand(time(NULL));
  13.  
  14. strcpy(valid_chars, "abcdefghijklmnopqrstuvwxyz");
  15.  
  16. strcpy(frase, "naruto");
  17. int num = strlen(frase);
  18.  
  19. for(int i = 0; i < 10; i++){
  20. for(int j = 0; j < 10; j++){
  21. int control = (rand() % 26);
  22.  
  23. mat_cript[i][j] = valid_chars[control];;
  24. }
  25. }
  26. for(int i = 0; i < num; i++){
  27. mat_cript[5][i] = frase[i];
  28. }
  29.  
  30. for(int i = 0; i < 10; i++){
  31. for(int j = 0; j < 10; j++){
  32. printf("\t%c", mat_cript[i][j]);
  33. }
  34. printf("\n");
  35. }
  36. }
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
	l	e	x	q	z	p	i	q	p	f
	l	k	s	f	k	u	h	u	c	p
	d	k	q	w	m	f	v	n	h	y
	e	u	c	b	l	b	t	v	t	k
	c	e	v	v	j	h	r	t	b	u
	n	a	r	u	t	o	i	a	g	r
	y	m	m	c	q	x	f	l	s	y
	v	x	e	s	s	q	a	j	j	d
	f	r	k	m	u	r	f	c	r	n
	t	s	c	f	u	u	e	a	f	z