ReadingLab / Discussion-for-Cpp

C++ 中文讨论区
MIT License
88 stars 63 forks source link

Cpp-Primer my fork markdown syntax problem #25

Closed mudongliang closed 9 years ago

mudongliang commented 9 years ago

ch05/README.md image image 这个文件中我修改了关于ex5_18.cpp的内容,我改的内容很简单,但是我不知道为什么显示的不对。 @pezy @Mooophy 帮忙看看这是什么语法问题! 我在我的电脑上的时候看着显示正确,但是github上面显示有问题。

pezy commented 9 years ago

@mudongliang

Markdown 的语法其实是和 HTML 一一对应的。Parse 的时候呢,> 引用会被解释为 <blockquote>,而普通的文本信息则会解释为 <p>。你在 (a) // Error 前面加了一个空行,于是解释器会在此处插入一个 </blockquote>,并将 (a) // Error等内容解释成 <p>

也就造成了你说的格式不对。

mudongliang commented 9 years ago

你的意思是把空行给删除吗? image 但是我把这个空行删除滞后,它的“修改预览“里面内容没有改变! image

pezy commented 9 years ago

唉,我改给你看吧:

Exercise 5.18

Explain each of the following loops. Correct any problems you detect.

(a) do 
        int v1, v2;
        cout << "Please enter two numbers to sum:" ;
        if (cin >> v1 >> v2)
            cout << "Sum is: " << v1 + v2 << endl;
    while (cin);
(b) do {
        // . . .
    } while (int ival = get_response());
(c) do {
        int ival = get_response();
    } while (ival);
(a) // Error: forget the curly braces when multiple statements must be
    //        executed as a block
    do {
        int v1, v2;
        cout << "Please enter two numbers to sum:" ;
        if (cin >> v1 >> v2)
            cout << "Sum is: " << v1 + v2 << endl;
    }while (cin);
(b) //Error: variable is declared in the condition of do while statement
    int ival;
    do {
        // . . .
    } while (ival = get_response());
(c) //Error: ival is not declared in scope
    int ival = get_response();
    do {
        ival = get_response();
    } while (ival);

摘自 https://raw.githubusercontent.com/mudongliang/Cpp-Primer/master/ch05/README.md 删除了空行。

mudongliang commented 9 years ago

这个好像是Github上面”Preview Change“的问题,我按照你说的方法进行修改之后,”Preview Change“上面没有变化!但是我建立一个分支进行测试的时候,结果和你的是一样的!

mudongliang commented 9 years ago

@pezy ,你觉得呢?