Teaching Newbies since 2014

kauress

  • Home
  • Javascript ❤
    • JavaScript
    • Node.js
  • WebDev Tuts
  • screencasts
  • Resources
  • VR & AR
  • Contact
  • Github
  • Twitter
  • YouTube
  • RSS
  • C++
You are here: Home / Home

January 10, 2020 by: Kauress

Enumerated types (Enum) in C++

Enum is a user defined data type in C++ whose value is equal to some user defined values. For example: Enum is useful for switch cases, when we expect a variable to have only one of the possible set of values. For example, we can change the code to:

[ Read More ]

January 9, 2020 by: Kauress

Adding/pushing data to a vector in C++

Adding data to a vector in C++ rephrased means “Push data/element into an array” in JavaScript. JavaScript uses the “push” method whereas C++ uses “push_back” In JavaScript you push an element into an array like so: The same way in C++ :

[ Read More ]

January 8, 2020 by: Kauress

File Streams in C++

This section could have been better. While not terrible, it misses alot in the hopes of not being too lengthy or verbose (my guess). So far cout has been used in order to print things referenced by variables, ints or strings to the console. The “cout” functionality has been provided by the iostream standard library. Files can also be read by what is known as

[ Read More ]

January 8, 2020 by: Kauress

Processing strings in C++ with

<sstream> let us store streamed data instead of just outputting it to cout. So we can read whole files. Input Stream with istringstream object: “Once an istringstream object has been created, parts of the string can be streamed and stored using the “extraction operator”: >>. The extraction operator will read until whitespace is reached or until the stream fail” Streaming int The istringstream can stream

[ Read More ]

January 7, 2020 by: Kauress

If-while statements in C++

If and while statements are pretty powerful as you can control when statement/statements of code are executed. Syntax: Example: While While statements allow you to execute a block of code till/while a condition is true Syntax: Example: Print out numbers 0-5 while i is less than or equal to <= 5

[ Read More ]

January 6, 2020 by: Kauress

C++ functions

A function may contain 1 or more statements of code. When a function is called, the statements of code within a function block are executed. Syntax: When a function need not return anything, we use the “void” return type: Example: This is a simple function called printString that takes in 2 parameters of the string data type and prints them out. The function printString is

[ Read More ]

January 6, 2020 by: Kauress

Printing out a 2D vector in C++

Here’s a nice pic of a 2D vector incase you’re wondering what it is to begin with: Declare, initialize a 2d vector and print it out Output:

[ Read More ]

January 6, 2020 by: Kauress

For loops in C++

For Loops are used to iterate over a set of statements for a particular condition. Syntax:

[ Read More ]

January 5, 2020 by: Kauress

Vectors in C++

Vectors are containers containing values of the same data type. I like to think of them like arrays. Vectors can resize automatically when an element is inserted or deleted . Since C++ is pretty close to hardware, vector elements are placed in adjacent storage so that they can travel across. Like arrays in JS, vector have methods such as insert( ), pop_back( ), erase( )

[ Read More ]

January 4, 2020 by: Kauress

String data type in C++

I’m finding out that Udacity’s Nanodegree is missing small details. I do believe someone wrote the curriculum over breakfast in bed and hurried up because their coffee was getting cold or something. ANYWAYS. To use strings in C++, they must be included in your program as such: This is because strings: A class in C++ Part of the standard library This is similar to how

[ Read More ]
  • « Previous Page
  • 1
  • …
  • 3
  • 4
  • 5
  • 6
  • 7
  • …
  • 16
  • Next Page »

Copyright © 2021 ·Kauress