|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Dec 2004
Messaggi: 783
|
[C] Problemino con funzione cos/log...
Oggi ho iniziato ad avere alcuni problemi con la compilazione di alcune funzioni matematiche. Anche gli esempi trovati su cplusplus.com/reference non vanno(dovrebbero andare anche per il C)
~/Desktop/prova$ gcc -o prog mate.c /tmp/cchdXBax.o: In function `main': mate1.c collect2: ld returned 1 exit status Il programma è il seguente Codice:
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
int main(void)
{
int variabile,max,min,i,y;
double x;
double param, result;
param = 5.5;
result = log (param);
printf ("ln(%lf) = %lf\n", param, result );
printf("Inserisci il masimo: ");
scanf("%d",&max);
printf("Inserisci il minimo: ");
scanf("%d",&min);
return 1;
}
Ciao
__________________
"May the wind always be at your back and the sun upon your face. And may the wings of destiny carry you aloft to dance with the stars...." |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Jul 2006
Città: Tristram
Messaggi: 517
|
Il programma mi pare corretto, a me gira senza problemi. Questi sono i prototipi delle logaritmiche definite in math.h, come vedi c'è anche la funzione log da te utilizzata.
Codice:
// log long double logl(long double); float logf(float); double log(double); double _logi(int);
__________________
Il sole è giallo |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Mar 2007
Messaggi: 1792
|
Usi Linux?
Hai compilato il codice con l'opzione -lm? |
|
|
|
|
|
#4 | |
|
Senior Member
Iscritto dal: Dec 2004
Messaggi: 783
|
Quote:
__________________
"May the wind always be at your back and the sun upon your face. And may the wings of destiny carry you aloft to dance with the stars...." |
|
|
|
|
|
|
#5 | |
|
Senior Member
Iscritto dal: Dec 2004
Messaggi: 783
|
Quote:
#?*°#§@$%@#ç BINGO me l'ero proprio perso....brutta dimenticanza!!! Grazie
__________________
"May the wind always be at your back and the sun upon your face. And may the wings of destiny carry you aloft to dance with the stars...." |
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 10:48.












#?*°#§@$%@#ç








