aiaiask.com©

开花即结果 提问即答案

将Java代码转换为C++代码
原始问题:

将Java代码转换为C++代码

#include <stdio.h>
#include <string.h>

int goodSubstrings(char *str) {
    int count = 0;
    int len = strlen(str);

    for (int i = 0; i < len; i++) {
        for (int j = i + 1; j <= len; j++) {
            if (isdigit(str[i]) && isdigit(str[j])) {
                count++;
            } else {
                break;
            }
        }
    }

    return count;
}

int main() {
    printf("%d  
", goodSubstrings("100"));
    printf("%d  
", goodSubstrings("10010"));

    return 0;
}
将Java代码转换为C++代码
https://www.aiaiask.com/ask/46473.html
AI / 模型Siliconflow
时间 / DATESeptember 8, 2023, 8:23 PM
语言zh-CN
IP / 区域加州Fremont