atoi

    -3熱度

    1回答

    我試圖做一個小例程,你輸入例如1 + 2和輸出應該是這兩個數字的總和。但它不斷崩潰,或者不會做任何事情。這是怎麼回事? #include <stdio.h> #include <stdlib.h> #include <string.h> int main(){ char *op; char *first; char *second; printf("Enter operatio

    -2熱度

    1回答

    我想從我在鍵盤中引入的數組中提取數字並將其轉換爲一個整數。我的代碼是: #include <stdio.h> #include <string.h> #include <stdlib.h> int main(void) { int r, t, i; char expressio[t]; char vector[50]; char rpn[t][4]

    -1熱度

    3回答

    我從c語言編寫了一本練習1-20的練習題。 的程序是: #include <stdio.h> #include <stdlib.h> /* for atoi() */ main(int argc, char *argv[]) { int c,i,n; if (argv[1]) n=atoi(argv[1]); while((c=getchar())!=

    0熱度

    2回答

    void main (void) { int length; length = atoi("Content: 111"); printf("atoi(\"Content: 111\") = %d\n",length); length = atoi("Content: 111" + 10); printf("atoi(\"Content:

    -1熱度

    3回答

    與此相關的問題,我已經檢查了其他職位已經使用了atoi函數將字符串轉換,但值始終爲0 這裏都存儲在hold4值: char hold4[4] = { "0", "." , "1", "5", "\0"); 我然後嘗試轉換爲int,我得到 int hm = atoi(hold4); hm打印出爲: hm = 0 我希望hm是0.15,因爲這是在hold4值。我想在隨後的數學運算中使用這個

    -3熱度

    1回答

    我目前的問題是從stdin中讀取未知數量的整數。我的方法是使用gets()將整行存儲爲char數組(char str[50])。我想解析char數組並將每個「字符串int」轉換爲一個整數並存儲在一個int數組中。我嘗試過使用strtol(nums[i]=strtol(A, &endptr, 10)),其中A是char數組,但是,當A的其餘部分也是數字時,endptr似乎不存儲任何內容,例如,如果A

    0熱度

    3回答

    我正在編寫一個程序,該程序需要使用A-I而不是1-9的數獨板,並檢查該板是否有效。 我從文件中讀取數獨板,並使用開關將所有值更改爲數字。 我的計劃是使用atoi或sscanf將2D char數組轉換爲2D int數組,以便我可以添加所有行和列以檢查它是否是有效的板。但是,當使用這些函數時,我得到以下警告: 期望類型const char但參數類型爲char或傳遞參數argumet sscanf其中一

    0熱度

    1回答

    #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> int main(int argc, const char *argv[]) { argc++; int number; printf("Enter word you would like encoded\n");

    16熱度

    1回答

    我明白所說的函數是做什麼的,但我不能猜測他們的名字是如何創建的,只是最後一個字母來自返回類型。

    6熱度

    1回答

    時,當嘗試使用STRCONV上通過URL傳遞變量(GET變量命名倍)拋出錯誤,GoLang上編譯載明下列失敗: 多值STRCONV .Atoi()在單值上下文 然而,當我做reflect.TypeOf我得到string類型,這在我的理解是正確的參數的類型。 我一直在試圖解決這個問題幾個小時。我是新來的,對這個問題感到非常沮喪。我終於決定尋求幫助。對於任何反饋,我們都表示感謝。 func numbe