Why ?


  • It is a Good first Language For Logic Building At the very least
  • Haad Great Community Support For DSA topics
  • Contains Both Functional and Object-Oriented Programming

How ?


  • Learn Basics, Most Important and Most Neglected Step
  • Lean DSA
  • Practice Consistency, Solve Questions

Prerequisite ?


  • Laptop - any Configuration
  • Curious Mind
  • Code, Don't Just Read or Watch Videos, even if it looks easy CODE along to get the BEST rRsults

First Program

1 2 3 4 5 6 7 8 #include <iostream.h> int main() { std::cout << "Hello World!" << std::endl; return 0; }

  • Line 2 #include <iostream.h> includes a cpp library(More About Library Later in the course), which helps for input and output related things
  • Line 4 int main() {and Line 6 }are starting and ending of a function defination (Again more about functions Later in the course)
    line 6 return 0; is also part of function
  • Line 5 std::cout << "Hello World!" << std::endl;is a Output Staement, which outputs Hello World!in the terminal std::endl it means go to next line
  • In cout statements we seprate expressions by <<
  • ; Indicates end of a statement
  • To avoid writting std:: again and again add using namespace std; on the top of your code

Variables

Variables are used to store values in them, in cpp each variable has different data type

  • int
    , stores integers (whole numbers)
    12, 43, 67, 2121321, 0 , -1
    , are correct

    0.2, 0.4, 0.234324, 12.21321
    , are wrong
  • double
    , stores floating point numbers,
    0.2, 0.4, 0.234324, 12.21321
    , are correct
  • char
    , stores single characters, They should be written inside ' ' single quotes
    'a', 'b', ' ', '1'
    , are correct

    "a", 'ab', 1
    , are wrong
  • string
    , stores text, They should be written inside " " double quotes
    "a", "bfasf3121", ""
    , are correct

    'ab', 1
    , are wrong
  • bool
    , stores text, They should be written inside " " double quotes
    true, false, 1, 0, -1, 1609, "sdfa"
    , are correct

Declaring Variables, Creating

1 2 3 4 5 6 7 8 9 10 11 12 13 #include <iostream.h> int main() { int x = 5; double y = 2.3; char c = 'A'; string s = "Web Mickey"; bool b = true; int p = 5, q = 3, r = 10; return 0; }

    Comment

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 // Comment Never Gets Executed // This is a single line comment // You will mostly use this cout << "Hello World!"; /* This is a Multi Line Comment You will rarely use this */

      Youtube Video