ciao a tutti cm da titolo volevo sapere che errore c'è nella funzione che utilizzo per calcolare il tempo di esecuzione..grazie in anticipo!!!
codice:
void disptempo (SYSTEMTIME st, SYSTEMTIME et)
{ //Display differenza tempo tra endtime e st (start time)
//restituisce il risultato in ore:minuti:secondi:millisecondi
long int lt=0,lst=1,let=0,resto=0;
int ore=0,min=0,sec=0,mls=0;
char gs[7] [2+1]={"DO","LU","MA","ME","GI","VE",SA"};
//calcolo start time in mls
lst=lst+(st.wHour * 3600000); //trasforma ore in mls
lst=lst+(st.wMinute * 60000); //trasforma min in mls
lst=lst+(st.wSecond * 1000); //trasforma sec in mls
lst=lst+(st.wMilliseconds); //somma mls
//calcolo end time in mls
let=let+(st.wHour * 3600000); //trasforma ore in mls
let=let+(st.wMinute * 60000); //trasforma min in mls
let=let+(st.wSecond * 1000); //trasforma sec in mls
let=let+(st.wMilliseconds); //somma mls
//calcolo tempo end time - start time in mls
lt=let-lst;
//trasforma lt da mls in ore,min,sec,mls
resto=lt;
ore=resto / 3600000;
resto=resto % 3600000; //resto=resto modulo mls in 1h
min=resto / 60000;
resto=resto % 60000;
sec=resto / 1000;
resto=resto % 1000;
mls=resto;
cout <<gs[st.wDayOfWeek]<<" "<<st.wDay<<"/"<<st.wMonth<<"/"<<st,wYear<<" Tempo: ";
cout <<"h"<<ore<<":m"<<min<<":s"<<sec<<":mls"<<mls<<" lt="<<lt<<"\n";
} /* end disptempo */
a me da errore nella 6 linea di codice (char ...) dicendo:
error C2059: syntax error : 'string'
e nella 36 dicendo:
error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'struct _SYSTEMTIME' (or there is no acceptable conversion)
error C2065: 'wYear' : undeclared identifier
error C2297: '<<' : illegal, right operand has type 'char [11]'