#39263: to_string


1120188@ccjh.cyc.edu.tw (詹以恩)


string s=to_string(pow(2,1000)); //將2^1000轉換為字串

int sum=0;

for(auto c:s){ //讀取s中的字元

(c!='.')&&(sum+=c-48) // '0'=48(ASCII) 

}