我正在使用Ubuntu,我也使用Geany和CodeBlock作为我的IDE.我正在尝试做的是读取一个字符串(如"Barack Obama")并将其放在一个变量中:
#include <stdio.h>
int main(void)
{
char name[100];
printf("Enter your name: ");
scanf("%s", name);
printf("Your Name is: %s", name);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
输出:
Enter your name: Barack Obama
Your Name is: Barack
Run Code Online (Sandbox Code Playgroud)
如何让程序读取整个名称?
我用Vim作为编辑."实用的常见Lisp"建议安装Lispbox,我不知道如何使用emacs,不知道如何使用该TT运行lisp代码之后我找到了vim的lisp插件,称为limp.vim,带有长而硬的安装指令:((最后我安装了"Clisp",我可以使用一个简单的命令运行lisp代码:
clisp ~/test.lisp
Run Code Online (Sandbox Code Playgroud)
但是如何编译呢?lisp是编译语言吗?对不起,我只是什么都不知道,我是lisp的新手
任何人都可以告诉我在linux上安装lisp到底需要什么?什么是SLIME,sbcl,......等等?
我读到这个:http://www.drpaulcarter.com/cs/common-c-errors.php#2.8 并且有一段代码:
#include <string.h>
#include <stdlib.h>
int main()
{
char *st = malloc(20); /* st points to allocated array*/
strcpy(st, "abc"); /* st points to char array */
free(st); /* don't forget to deallocate when done! */
return 0;
}
Run Code Online (Sandbox Code Playgroud) 在文档中,它说:
fetch(key [,default])→obj; fetch(key){| 关键| block}→obj
返回给定键的哈希值.如果找不到密钥,则有几个选项:如果没有其他参数,则会引发KeyError异常; 如果给出了默认值,那么将返回; 如果指定了可选代码块,那么将运行该代码块并返回其结果.
在我的航站楼,irb说:
irb(main):001:0> hash = { 1 => "No one", 2 => "gonna", 3 => "fetch me" }
=> {1=>"No one", 2=>"gonna", 3=>"fetch me"}
irb(main):002:0> hash.fetch(4)
IndexError: key not found
from (irb):2:in `fetch'
from (irb):2
from :0
Run Code Online (Sandbox Code Playgroud)
你能帮我解释一下吗?
谁能向我解释一下维基百科上排序算法的“图形插图”是什么意思?我无法理解他们。
冒泡排序

插入排序
