これが私の質問です。数値をファイルに保存するためにchar temp [100]を作成しました。これtemp_i
は現在の位置のインデックスです(数値には数字がありtemp_i
ます)
char配列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);
}
}