Jupyter Notebook C用户输入 [英] Jupyter Notebook C user input
本文介绍了Jupyter Notebook C用户输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在接受用户输入的Jupyter笔记本中编写一些简单的C代码.一个示例是:
I am trying to some simple C code in a Jupyter notebook that accepts user input. An example of this is:
// 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内核吗?
without ever giving a chance for user input. Is there a way to do this the Jupyter C kernel?
推荐答案
有没有办法实现Jupyter C内核?
Is there a way to do this the Jupyter C kernel?
现在不行.似乎他们仍在努力.
Not right now. Seems like they are still working on it though.
请参阅: https://github.com/brendan-rius/jupyter-c-kernel/issues/3
这篇关于Jupyter Notebook C用户输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文