so basically i cant figure out whats wrong here, im trying randomize the two rand numbers with time, but everytime i run it the same numbers show. i really cant tell whats wrong :(
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int i, j, m, n, primeira, tipo, orient;
int matrix[10][20];
time_t tempo = time(NULL);
printf("Enter number of rows : ");
scanf("%d", &m);
printf("Enter number of columns : ");
scanf("%d", &n);
/* first input */
printf("1 ou 0");
scanf("%d", &primeira);
if (primeira == 0) {
matrix [0][0]=0;
matrix [0][1]=0;
matrix [0][2]=0;
matrix [1][0]=0;
matrix [1][1]=0;
matrix [1][2]=0;
matrix [2][0]=0;
matrix [2][1]=3;
matrix [2][2]=0;}
else
{srand(tempo);
tipo = rand() % 9;
orient = rand() % 4;
Aucun commentaire:
Enregistrer un commentaire