|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Dec 2004
Messaggi: 783
|
[C] Ciclo for e type casting
Parto direttamente con il problema sperando che si capisca meglio
Codice:
int main()
{
int i;
double num;
.................
for(i=0;i<num;i++)
.................
}
Codice:
warning: conversion lacks type at end of format Codice:
for(i=0;i<((int)num);i++) for(i=0;i<(int)num;i++) Come posso eliminarlo? Non posso dichiarare num come intero poiche...va be non credo che sia interessante .Grazie per l'aiutino. 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: Dec 2004
Messaggi: 783
|
Risolto...non era quello il problema ma stava sulla stessa riga
Visto che ci siamo: quale delle due soluzione è la migliore? La seconda ha due parentesi di troppo? Grazie di nuovo e scusate il disturbo.
__________________
"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...." |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Nov 2005
Messaggi: 2782
|
Codice:
for(i=0;i<((int)num);i++) |
|
|
|
|
|
#4 | |
|
Senior Member
Iscritto dal: Dec 2004
Messaggi: 783
|
Quote:
Grazie ciao. PS L'abbondanza non crea problemi ma lo rende un po piu pesante da leggere
__________________
"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: Oct 2007
Città: Padova
Messaggi: 4131
|
Magari puoi separare le cose con gli spazi, tipo:
Codice:
for(i=0; i<((int)num); i++) Codice:
for( i = 0; i < (int)num; i++) {
// loop code here
}
|
|
|
|
|
|
#6 |
|
Senior Member
Iscritto dal: Nov 2005
Messaggi: 2782
|
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 16:41.










.









