這是我的問題,我創建炭溫度[100]以存儲在一個文件中的數字,temp_i
是當前位置的索引(號碼具有temp_i
位數)如何分析字符數組成雙
如何將字符數組temp從0轉換爲temp_i
爲我創建的value
?
任何身體能幫助我嗎?
stack<int> first;
char temp[10]={'0','0','0','0','0','0','0','0','0','0'};
int temp_i = 0;
bool isDouble = false;
for(int index = 0; index< strlen(str); index++){
if(str[index] != ' '){
temp[temp_i++] = str[index];
}
else if(str[index] == '.') {
isDouble = true;
} else {
double value = *(double*)temp;
cout<<value<<endl;
first.push(value);
}
}
「這個數字有TEMP_I數字」 ..嗯#grammar編譯器錯誤。 – Julius