GithubHelp home page GithubHelp logo

linear-cpp's Introduction

Linear C++

A C++ tutorial that can (hopefully?) be followed without jumping from chapter to chapter at every step.

Downloads:

Building

Via a bash shell, compiling all chapters:

for a in Chapter*; do g++ -std=c++11 -o "$a/out" "$a"/*.cpp; done

On OSX:

  • You must install XCode and the Command Line Tools package. As of 9/04/2013, Mac OS X doesn't ship with a C++11 compiler.
  • Then use clang to build:
for a in Chapter*; do clang++ --std=c++11 --stdlib=libc++ "$a"/*.cpp -o "$a"/out; done

Also, when compiling your own files on either of those two platforms, I recommend you add -Wall and -Wextra to your flags. Clang users may also want to add -fsanitize=undefined.

Markdown and EPUB

Thanks to @Gullumluvl it's possible to export these chapters as Markdown or epub files!

To do so, just run

./cpp_2_markdown.py Chapter\ NN*

where NN is the number of the chapter.

You can use

./cpp_2_markdown.py .

to build the whole book.

For building an epub, make sure you have pandoc and run

pandoc -M author=jesyspa \
  --standalone \
  -V 'header-includes="<style>pre > code.sourceCode {white-space: pre-wrap !important;}</style>"' \
  --toc --toc-depth=1 \
  -o linear-cpp.epub \
  ebook.md

The header-includes argument is needed to wrap long code lines.

Future plans

This project is discontinued. I don't plan to update it for new C++ standards or add any new language features.

Outline of what's coming missing:

  • Practical Examples
  • Variants, Optional
  • Most of inheritance
  • Scope
  • Storage Duration
  • Undefined Behaviour
  • File IO
  • Libraries: Boost, Abseil...
  • Metaprogramming
  • C++14 and up
  • The preprocessor
  • Most C features

So while I'm glad people have found it useful, please don't rely on this by itself to learn C++! It really only scratches the surface, and you'll do yourself a service if you get a good book.

linear-cpp's People

Contributors

gullumluvl avatar jesyspa avatar markharder avatar masonk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linear-cpp's Issues

A converter into markdown/epub format

Hi,

not an issue, just a possible contribution.

This tutorial is just awesome, and I wanted to have it on my e-reader. Since you mention this in README:

Generating more human-readable files from the tutorials (or the other way around?)

I made a small script to turn it into markdown, then epub, it's here: github.com/Gullumluvl/cpp_2_markdown.git

Sorry, that was not written in C++ though...!

best

P.S: the formatting is already so neat that making it a clean markdown was way too easy.

Is #include <string> header in chapter 3 necessary?

Hi,

I just finished chapter 3 and I noticed my IDE has greyed out the header - #include - suggesting that it isn't necessary. The program appears to run fine with or without it.

I can't see anywhere std::string is used in the program. Is it being used somewhere I haven't noticed and my IDE thinks it is unnecessary because the header is implicit in - #include - or is this really not needed?

If std::string is used, is it considered good practice to make headers explicit, rather than implicit in C++?

std::cin.eof()

Hi,
I wasn't able to exit program in chapter 6, i keep typing numbers in the terminal but where end of file?

if(std::cin.eof()) {
break;
}

when it breaks?

What is a char?

With the proliferation (if I think of a word that sounds more like how a disease spreads, I'll edit this) of unicode, it's become pretty common for new languages to make allowances for unicode strings, or to use unicode strings natively. In both cases, a character is a pretty strange type--and often we're talking about something that is 16 or 32 bits wide. This isn't the case in C++. I actually don't know off the top of my head what a character in C++ is (I think it's an 8-bit value representing... ascii?), so I think that (for experienced programmers, anyway) it might be good to mention that in passing.

Error compiling on OS X Catalina

I'm getting this error when compiling using the suggested line for OS X.

Chapter 20 - Function Objects/builtin_operations.cpp:12:17: error: no member named 'accumulate' in namespace 'std'
    return std::accumulate(std::begin(args), std::end(args), 0);
           ~~~~~^
Chapter 20 - Function Objects/builtin_operations.cpp:24:17: error: no member named 'accumulate' in namespace 'std'
    return std::accumulate(std::begin(args), std::end(args), 1, std::multiplies<int>{});
           ~~~~~^
2 errors generated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.