lion-han

a new word


  • Home

  • Tags

  • love

  • Archives

  • Sitemap

简单编辑器

Posted on 2018-10-14

简单编辑器

Description:

要开发一个字符界面的编辑器,对文本的编辑操作是通过输入一个一个的“行编辑命令”完成的。

系统约定: 行编辑命令由命令关键字 命令参数组成。其中,命令关键字都是单一的字母,命令与参数之间使用一个空格进行分割,当命令参数为多个时采用 / 作为参数的分隔符,如果在命令的参数中间出现符号 / ,则用 \/ 表示。我们将 / 定义为转义符。

行插入:

1
i #/串

在指定行号(> 0)插入一个新行,新行的内容就是命令中给出的串。若插入的行超过了已有的行数,则在最后一行的后面插入一个新行。

文本替换:

1
c 被替换串/替换串

将整个文本中全部被替换串替换为替换串

行删除:

1
d #

其中#为指定的行号(不含#)

行合并:

1
f 1/2/3...
Read more »

string 结构体赋值

Posted on 2018-09-30

结构体中string赋值

在进行一下操作时,下面一行调试出现错误,程序终止。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
typedef struct NODE
{
string line;
struct NODE *next;
} node;
node *head;
node *p,*q,*HEAD;
main()
{
char op;
int n=0,num;
p=(node*)malloc(sizeof(node));
p->next=NULL;
HEAD=p;
head=p;
while(1)
{
getline(cin,a);
p = (node*)malloc(sizeof(node));//*****
p->line=a; //出现错误!!! *****************
head->next=p;
p->next=NULL;
head=p;
n++;
}
}

由于:结构体内的string不定长,不能动态分配内存,需要用用new来分配内存

malloc只是分配内存。
new除了分配内存还会调用构造函数的。

应将

1
p = (node*)malloc(sizeof(node));

改为

1
p = new NODE;

java 环境配置

Posted on 2018-09-24

1.新建一个文本文档,重命名为:HelloWorld.java(注意把.txt的后缀名改为.java)(此处我用sublime)

2.写入:类的名字HelloWorld必须和文档名相同

1
2
3
4
5
public class HelloWorld{
public static void main(String[] args){
System.out.println("HelloWorld");//尽量不要有中文
}
}

3.运行:

PS F:> javac HelloWorld.java
PS F:> java HelloWorld.java
错误: 找不到或无法加载主类 HelloWorld.java
原因: java.lang.ClassNotFoundException: HelloWorld.java
PS F:> java HelloWorld
Hello World!

Read more »

github 发布文章错误收集

Posted on 2018-09-12

Unable to create ndex.lock

之前因为这个错误什么都改不了,终于找到这个bug:

FATAL Something’s wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: fatal: Unable to create ‘D:/hexo/blog/.deploy_git/.git/index.lock’: File exists.

可能是之前在git没有运行完成的时候强制关闭,下次提交的时候产生的错误

找.deploy_git 文件夹,进去可能没有.git ,打开隐藏文件,找 index文件 删除就好了。

Read more »

two-term

Posted on 2018-09-12

打包礼物

Description:

有k个礼物,如果两个礼物的体积满足小礼物的体积的两倍不超过大礼物的体积,那么小礼物可塞在大礼物里。同时**一个大礼物里最多只能塞一个其他小礼物,小礼物里可包含其他更小的礼物。如果小礼物被塞进大礼物里了,那么就不用再付小礼物的快递费了。如何使得最后剩下的礼物数量最少?

Input:

输入第一行有一个正整数 n,表示礼物的数量;

接下来一行共 n 个正整数,依次表示这些礼物的体积 V ;

Read more »

one term

Posted on 2018-08-31

小学期第一波题

A+B (I)

Description:二进制加法

T 组数据[1,10];接下来 T 行,每行输入两个二进制串 a 和 b 中间用空格隔开,保证它们长度 a,b<=1000 并且没有前导 0。 如 输入:

  1. 1↵
  2. 11101 110↵ 输出
1
2
3
4
   11101
+ 110
--------
100011
Read more »

atom use

Posted on 2018-08-19

there will be same usage of atom.

  • 预览快捷键 Shift + Ctrl + M

first

Posted on 2018-08-18

今天终于弄好了简单的GitHub的博客,但是好难看啊

Hello World

Posted on 2018-08-17

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.hahah

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

wanghan

wanghan

9 posts
4 tags

© 2018 wanghan
Powered by Hexo
|
Theme — NexT.Pisces v5.1.4