Jump to content

passing `long int' to argument 1 of `inic(long int *, long int *)' lacks a cast


Gurzi
 Share

Recommended Posts

#include <stdio.h>
#include <stdlib.h>
#include <time.h>


int numeros[49];
int numero_gerado[4];


void inic(int nu[49],int gerador[4])
{
  int i,j;
   for(i=1;i<=50;i++)
     nu[i-1] = i;
   for(j=1;j<=5;j++)
      gerador[j] = j;
}
void mostra()
{
  int i;
  for (i=0;i<=50;i++)
   {
     if (!(i%7))
       putchar('n');
     printf("%d ", i);
    }
}
void aleatorio(int s[4])
{
   int j;
   for (j=1;j<=5;j++)
   {
    time(numero_gerado[j]);
    srand((unsigned int)numero_gerado[j]);
   }
}
main()
{
     int i,j;

     inic(numeros,numero_gerado);
     printf("Benvindo ao Jogo de Apostas do EuroEcol\n\n");
     mostra();
     getchar();
     aleatorio(numero_gerado);
     srand((unsigned int)aleatorio);
     for (i=1;i<=50;i++)
        for (j=1;j<=5;j++)
         {
          if(numeros[i]== numero_gerado[4])
            printf("XX");
          else
            printf("%d",numeros[i]);
          }
      system("PAUSE");
  }




33 d:\docume~1\tiagop~1\osmeus~1\exerci~1\testes.cpp

passing `long int' to argument 1 of `inic(long int *, long int *)' lacks a cast

estou aqui um pouco aterefado 😛 :wallbash:

Link to comment
Share on other sites

A mim na função aleatorio dá este:

32 C:\Documents and Settings\Bruno\Desktop\Untitled1.cpp invalid conversion from `int*' to `time_t*'

Do q percebi do teu codigo acho que tens outro erro:

  for (j=1;j<=5;j++)

    time(numero_gerado[j]);

    srand((unsigned int)numero_gerado[j]);

Se queres q o time e o srand estejam ambos no ciclo for precisas de fazer um bloco 😄

Link to comment
Share on other sites

O time recebe um endereço de uma variavel do tipo time_t... exemplo:

time_t t1;

time(&t1);

😄 Ja agora dá uma olhadela pelas guardas dos outros ciclos for que tens no teu codigo porque têm erros como aqueles que já falamos! 😄

Declaration:

    time_t time(time_t *timer);

Calculates the current calender time and encodes it into time_t format.

The time_t value is returned. If timer is not a null pointer, then the value is also stored into the object it points to. If the time is unavailable, then -1 is returned.

(fonte)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.