Posts

Controlling Program Flow(Its all about how you practice)😁

Image
Section Overview: Sequence Ordering Statements sequentially Selection Making Decisions Iteration Looping or Repeating Important! with Sequence, Selection, and Iteration we can implement any algorithm. Selection - Decision Making: if statement If-Else statement  Nested if statement  Switch Statement  Conditional Operator ? : Iteration - Looping For loop Range-based For loop While loop do-while Loop continue and break Infinite Loops Nested Loops If Statement: if (expression)                 statement If the expression is true then execute the statement If the expression is false then skip the statement If statement - Block: if (expression){ statement 1; statement 2; } Create a block of code by including more than one statement in code block {}. Blocks can also contain variable declarations. These variables are visible only within the block - local scope. Exercise: In this exercise, you

Expressions,Statements, and Operators 👀

Image
Section Overview: Expressions, Statements, and Operators: Expressions  Statements and Block Statements Interesting Exercise Operators Assignment  Arithmetic Increment and Decrement  Equality Relational Logical  Compound Statement Precedence Expressions: An expression is: The most basic building block of a program. "A sequence of operators and operands that specifies a computation". Computes a value from a number of operands. There is much, much more to expressions - not necessary at this level. Examples: 34                               // Literal  favourite_number     //Variable  1.5+2.8                    // Addition 2*5                         //Multiplication a>b                       // Relational a=b.                    // Assignment Statements: A statement is: A complete line of code that performs some action. Usually terminated with a semi-colon Usually contains expressions C++ has many types of statement

Arrays and Vectors ❤️

Image
Section Overview: Arrays What they are  Why we use arrays Declaration and Initialization Accessing array elements Multi-Dimensional Arrays Vectors  what they are  Advantages vs arrays Declaration and Initialization Interesting Exercise What are Arrays? An array contains a group of elements with the same data type, Basically, we use arrays to organize the data so that the related values can be easily sorted and searched. Examples: A search engine may use an array to store Web pages found in a search performed by the user. The program will display only one element of the array at a time. This may be done for a specified number of values or until all the values stored in the array have been output. Storing the result in an array is a much more efficient way to manage memory. Why we use Arrays: We know that array is a collection of data, but it is often more useful to think of an array is a collection of variables of the same type. Instead

Getting Started 😍

Image
Getting Started:-  Writing our first program  : In this program, we covered the basic concepts of the Structure of the C++ program, Variables, Input and Output streams.  Structure of C++ Program: int main():   The void main() indicates that the main() function will not return any value, but the int main() indicates that the main() can return an integer type data. When our program is simple, and it is not going to terminate before reaching the last line of code, or the code is error-free, then we can use the void main(). #include<iostream>:   It is the predefined library function used for input and output also called a header file. iostream is the header file which contains all the functions of program like cout, cin, etc, and #include tells the preprocessor to include these header files in the program. using namespace std:   Since its creation, C++ has gone through many changes by the C++ standards committee. One of the new features ad

Basic things You need to Know in C++😁

Image
What is an Error ?  Errors are the mistakes or faults in the program that causes our program to behave unexpectedly and it is no doubt that the well versed and experienced programmers also make mistakes. Programming error is generally known as bugs and the process to remove bugs from the program is called Debugging. Syntax errors:  Errors that occur when you  violate the rules  of writing C/C++ syntax are known as syntax errors. This compiler error indicates something that must be fixed before the code can be compiled. All these errors are detected by the compiler and thus are known as compile-time errors. Run-time Errors :  A runtime error occurs while the program is running. There are many different types of runtime errors. One example is the Logic Error, which produces the wrong output. Another type of error is Memory Leak. This type of error can cause a program to continually use up more RAM while the program is running. A memory may be due to an infinite loop,

Tutorials on C++ 😁😁

Image
Why do we learn C++ ? There are three main reasons for us to learn C++: Popularity : Lots of code is still returned in C++. Programming language popularity indexes. Active Community in Github, Stack Overflow and many other platforms. Relevant : Windows, Linux and Gaming Engines more ... Amazon, Google, and many other Multinational Companies use this language. Powerful : Fast, Flexible, Scalable and Portable. Procedural and Object-Oriented Programming Language. Good Career Opportunities : C++ skills are always in demand. C++ == Salary++. How to it Works? When you write a source code file in C++, you include header files with extensions .h, .hxx, or .hpp, and sometimes with no extensions. You use the directive #include to mark a header file. The source file usually has the extension .cc, .cxx or .cpp. First Step (Preprocessing) : In this process first, the compiler is sent to the preprocessor(simply a directive that starts with #). So #incl