Chapter 1

This is just about hello world in CPP

Using this I just want to check if the code highlight is there or not C++

Adding an image without using height and width

Cpp

Adding image using img tag with width and height

some randome name

Center align image

some randome name

Info

Cpp is awesome!

Code

C++ Hello world code


#include<iostream>
using namespace std;

int main(){
    cout<<"hello world "<<endl;
    cout<<"This is getting some update";
    return 0;
}

Add two number

int main(int a, int b) {
    // adds and returns the result
    return a + b;
}

Note

Do you have any notes.(give 4 space above to show the line in the next line)
This can be collapsed, use collapasable=true

Info

Cpp is awesome!

Danger

Cpp is awesome!

This is admonish success with title

Cpp is awesome! , this is with title, for that we need to use title="some title"

This is a bug

A code segmenent can also be made as a part of admonish block , but in that case the admonish block should be enclosed with ~~~ and code with ```

#include<iostream>
int main() {
    return null;

}

This is admonish tip

Cpp is awesome! , this is with title, for that we need to use title="some title"

This is admonish example

Cpp is awesome! , this is with title, for that we need to use title="some title"

This is admonish question

Cpp is awesome! , this is with title, for that we need to use title="some title"

This is admonish failure

Cpp is awesome! , this is with title, for that we need to use title="some title"

This is admonish quote

Cpp is awesome! , this is with title, for that we need to use title="some title"

This is admonish abstract

Cpp is awesome! , this is with title, for that we need to use title="some title"

Success without title

Adding code from a source code file

This code is coming from cpp_code/welcome.cpp file


#include<iostream>
using namespace std; 

int main() {

    cout<<"You are welcome to this world!";
}

Tip

For nesting code with admonish we can use ````(4) instead of ```(3), as done in the above example

Adding tables

MonthSavings
January$250
February$80
March$420

This is just about hello world in CPP

Using this I just want to check if the code highlight is there or not C++

Adding an image without using height and width

Cpp

Adding image using img tag with width and height

some randome name

Center align image

some randome name

Info

Cpp is awesome!

Code

C++ Hello world code


#include<iostream>
using namespace std;

int main(){
    cout<<"hello world "<<endl;
    cout<<"This is getting some update";
    return 0;
}

Add two number

int main(int a, int b) {
    // adds and returns the result
    return a + b;
}

Note

Do you have any notes.(give 4 space above to show the line in the next line)
This can be collapsed, use collapasable=true

Info

Cpp is awesome!

Danger

Cpp is awesome!

This is admonish success with title

Cpp is awesome! , this is with title, for that we need to use title="some title"

This is a bug

A code segmenent can also be made as a part of admonish block , but in that case the admonish block should be enclosed with ~~~ and code with ```

#include<iostream>
int main() {
    return null;

}

This is admonish tip

Cpp is awesome! , this is with title, for that we need to use title="some title"

This is admonish example

Cpp is awesome! , this is with title, for that we need to use title="some title"

This is admonish question

Cpp is awesome! , this is with title, for that we need to use title="some title"

This is admonish failure

Cpp is awesome! , this is with title, for that we need to use title="some title"

This is admonish quote

Cpp is awesome! , this is with title, for that we need to use title="some title"

This is admonish abstract

Cpp is awesome! , this is with title, for that we need to use title="some title"

Success without title

Adding code from a source code file

This code is coming from cpp_code/welcome.cpp file


#include<iostream>
using namespace std; 

int main() {

    cout<<"You are welcome to this world!";
}

Tip

For nesting code with admonish we can use ````(4) instead of ```(3), as done in the above example

Adding tables

MonthSavings
January$250
February$80
March$420

Python is a good programming language

Code : Hello world

Example

This is the python code example

print("hello world")

Embbeding the code using include tag and from a source file

# This is hello world program in python

print("Hello world")

Embbeding the code using include tag and from a source file and wrapping it with admonish success

Python class demo

# This is class demo code

class Base():
    # constructor
    def __init__(self, name):
        self.name = name
    
    # print function
    def printMe(self):
        print(f"Just normal printing {self.name}")


# create an object of Base class
obj = Base("chandra")
obj.printMe()

Python is a good programming language

Code : Hello world

Example

This is the python code example

print("hello world")

Embbeding the code using include tag and from a source file

# This is hello world program in python

print("Hello world")

Embbeding the code using include tag and from a source file and wrapping it with admonish success

Python class demo

# This is class demo code

class Base():
    # constructor
    def __init__(self, name):
        self.name = name
    
    # print function
    def printMe(self):
        print(f"Just normal printing {self.name}")


# create an object of Base class
obj = Base("chandra")
obj.printMe()

Python is a good programming language

Code : Hello world

Example

This is the python code example

print("hello world")

Embbeding the code using include tag and from a source file

# This is hello world program in python

print("Hello world")

Embbeding the code using include tag and from a source file and wrapping it with admonish success

Python class demo

# This is class demo code

class Base():
    # constructor
    def __init__(self, name):
        self.name = name
    
    # print function
    def printMe(self):
        print(f"Just normal printing {self.name}")


# create an object of Base class
obj = Base("chandra")
obj.printMe()

Python is a good programming language

Code : Hello world

Example

This is the python code example

print("hello world")

Embbeding the code using include tag and from a source file

# This is hello world program in python

print("Hello world")

Embbeding the code using include tag and from a source file and wrapping it with admonish success

Python class demo

# This is class demo code

class Base():
    # constructor
    def __init__(self, name):
        self.name = name
    
    # print function
    def printMe(self):
        print(f"Just normal printing {self.name}")


# create an object of Base class
obj = Base("chandra")
obj.printMe()

C++ Basics

Topics

  • Statements and the structure of a program
  • Comments
  • Introduction to objects and variables
  • Variable assignment and initialization
  • Introduction to iostream: cout, cin, and endl
  • Uninitialized variables and undefined behavior
  • Keywords and naming identifiers
  • Whitespace and basic formatting
  • Introduction to literals and operators
  • Introduction to expressions
  • Developing your first program
  • Chapter 1 summary and quiz

1.1 — Statements and the structure of a program

Chapter introduction

Welcome to the first primary chapter of these C++ tutorials! Dummy md file

In this chapter, we’ll take a first look at a number of topics that are essential to every C++ program. Because there are quite a few topics to cover, we’ll cover most at a fairly shallow level (just enough to get by). The goal of this chapter is to help you understand how basic C++ programs are constructed. By the end of the chapter, you will be able to write your own simple programs.

In future chapters, we’ll revisit the majority of these topics and explore them in more detail. We’ll also introduce new concepts that build on top of these.

In order to keep the lesson lengths manageable, topics may be split over several subsequent lessons. If you feel like some important concept isn’t covered in a lesson, it’s possible that it’s covered in the next lesson.

Statements

A computer program is a sequence of instructions that tell the computer what to do. A statement is a type of instruction that causes the program to perform some action.

Statements are by far the most common type of instruction in a C++ program. This is because they are the smallest independent unit of computation in the C++ language. In that regard, they act much like sentences do in natural language. When we want to convey an idea to another person, we typically write or speak in sentences (not in random words or syllables). In C++, when we want to have our program do something, we typically write statements.

Most (but not all) statements in C++ end in a semicolon. If you see a line that ends in a semicolon, it’s probably a statement.

In a high-level language such as C++, a single statement may compile into many machine language instructions.

1.2 — Comments

ALEX
SEPTEMBER 8, 2023

A comment is a programmer-readable note that is inserted directly into the source code of the program. Comments are ignored by the compiler and are for the programmer’s use only.

In C++ there are two different styles of comments, both of which serve the same purpose: to help programmers document the code in some way.

Single-line comments

The // symbol begins a C++ single-line comment, which tells the compiler to ignore everything from the // symbol to the end of the line. For example:

This is just a dummy md file