Created
March 31, 2018 00:34
-
-
Save wilsenhc/ded056b18cd29f6f17066f2a3e218242 to your computer and use it in GitHub Desktop.
Generadores de Matrices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Generador de Casos Jhon Coello*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
int main() | |
{ | |
int dimension = 100, i, j; | |
srand(time(NULL)); | |
printf("%d\n0.00001\n%d\n", dimension, dimension*dimension); | |
for (i = 0; i < dimension; i++) | |
{ | |
printf("%d ", 0); | |
} | |
printf("\n"); | |
int m = ((dimension * dimension) - 10) + 1, n = (dimension * dimension) + dimension; | |
for (i = 0; i < dimension; i++) | |
{ | |
for (j = 0; j < dimension; j++) | |
if(i == j) | |
{ | |
printf("%d ", rand() % (n - m) + m); | |
} | |
else | |
{ | |
printf("%d ", rand() % dimension); | |
} | |
printf("\n"); | |
} | |
for (i = 0; i < dimension; i++) | |
{ | |
printf("%d ", rand() % dimension*2); | |
} | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Generador de Casos Jhon Coello*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include <time.h> | |
int main() | |
{ | |
float i, j; | |
float dimension; | |
float aux; | |
srand(time(NULL)); | |
scanf("%f", &dimension); | |
printf("%d\n0.00001\n%d\n", (int)dimension, (int)(dimension*dimension)); | |
for (i = 0; i < dimension; i++) | |
{ | |
printf("%1.2f ", 0.0); | |
} | |
printf("\n"); | |
//float m = ((dimension * dimension) - 10) + 1, n = (dimension * dimension) + dimension; | |
for (i = 0; i < dimension; i++) | |
{ | |
for (j = 0; j < dimension; j++) | |
if(i == j) | |
{ | |
printf("%f ", (sin((float)rand())+dimension)*dimension); | |
} | |
//valor=(sin((float)rand())+1.0)*50.0; | |
else | |
{ | |
printf("%f ", (sin((float)rand())+1.0)*dimension/2); | |
} | |
printf("\n"); | |
} | |
for (i = 0; i < dimension; i++) | |
{ | |
printf("%f ", (sin((float)rand())+dimension)*dimension); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment