Git Product home page Git Product logo

instant-cpp's Introduction

alt text

Instant-Cpp

List of C++ topics and their code snippets!

Theory

  • C++ supports classes and objects, while C does not.
  • Escape Sequences: It forces the cursor to change its position.
    • \n Creates a new line.
    • \t Creates a horizontal tab.
    • \ Inserts a backslash character ()
    • " Inserts a double quote character
  • << insertion operator
  • extraction operator

Package definition and imports

#include <iostream>
using namespace std;

Comments

// This is a comment

/* This is a multi-line comment.
   You can add some helpful text here. */

Printing to Console

printf("Hello World \n");
std::cout << "Hello World!";

Data Types

int number; // 2 or 4 bytes. ex: -n, 0, n
float storeCount; // 4 bytes. ex: -0.3, 0, 0.0193
double pi; // 8 bytes. ex: -0.01242324, 0, 0.01234232 
char letter; // 1 byte. ex: 'a', 'z'
string text; // ex: "Hello"
bool isValid; // 1 byte. ex: true or false

Constants

const int pi = 3.14;

Variables

int myNum = 15;

int myNum2;
myNum2 = 15;

Booleans

cout << true; // 1
cout << false; // 0

Scientific Notation

float num1 = 35e5; // This means 3500000 or 35 * 10^5
double num2 = 35E5;

Operators

Arithmetic Operators

j + k
j - k
j * k
j / k
j % k
++j
--k

Assignment Operators

j += 5;
j -= 2;
j *= 4;
j /= 9;

Conditionals

Loops

Collections

Classes

Functions

int main() {
    std::cout << "Hello World!";
    return 0; // Ends the main function
}

Instantiation and Intitialization

Inheritance

Composition


References


How to edit?

instant-cpp's People

Contributors

singularity-coder avatar

Watchers

 avatar

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.