Jupyter Notebook C用户输入

问题描述 投票:0回答:1

我正在尝试在接受用户输入的Jupyter笔记本中使用一些简单的C代码。一个例子是:

// Problem 7.4
// Write a program that calculates the average of an array of 10 floating-point values.

    #include <stdio.h>

    int main (void)
    {
        float values[10] = {0};

        for ( int i = 0; i <= 10; i++ )
        {
            printf("Enter the %ith number: ", i);
            scanf("%f", &values[i]);
            printf("\n");
        }
    }

输出很简单:

Enter the 0th number: 
Enter the 1th number: 
Enter the 2th number: 
Enter the 3th number: 
Enter the 4th number: 
Enter the 5th number: 
Enter the 6th number: 
Enter the 7th number: 
Enter the 8th number: 
Enter the 9th number: 
Enter the 10th number: 

没有给用户输入的机会。有没有办法做这个Jupyter C内核?

c jupyter-notebook scanf
1个回答
1
投票

有没有办法做这个Jupyter C内核?

不是现在。看起来他们仍然在努力。

见:https://github.com/brendan-rius/jupyter-c-kernel/issues/3

© www.soinside.com 2019 - 2024. All rights reserved.