討論串[問題] 字串轉二進位整數
共 3 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓3(3推 0噓 0→)留言3則,0人參與, 最新作者lgen7604時間16年前 (2010/05/08 18:52), 編輯資訊
0
0
1
內容預覽:
C 的 strto?? 我覺得也滿好用的. #include <stdio.h>. #include <stdlib.h>. #include <string.h>. int main (void) {. char str[80];. char *endptr;. int i;. printf("E
(還有284個字)

推噓9(9推 0噓 3→)留言12則,0人參與, 最新作者james732 (好人超)時間16年前 (2010/05/08 17:18), 編輯資訊
0
0
0
內容預覽:
#include <iostream>. #include <bitset>. using namespace std;. int main(). {. bitset<16> b(string("1010"));. cout << b.to_ulong() << endl;. }. (bitset真

推噓1(1推 0噓 0→)留言1則,0人參與, 最新作者That5566is78 (5566反串好累)時間16年前 (2010/05/08 16:58), 編輯資訊
0
0
0
內容預覽:
遇到的問題: 字串"1010". 希望得到的正確結果:int :10. 開發平台: VC++ or g++. 我知道有atoi的函數可以用 但是因為字串是二進位的. 所以有有什麼辦法轉換嗎?. 還是要用讀字串 慢慢一個bit累加上去?. 感謝. --. 發信站: 批踢踢實業坊(ptt.cc).
首頁
上一頁
1
下一頁
尾頁