What is a const? 🚫

Поділитися
Вставка
  • Опубліковано 2 лют 2025

КОМЕНТАРІ • 75

  • @BroCodez
    @BroCodez  2 роки тому +12

    #include
    int main() {
    const double PI = 3.14159;
    //PI = 420.69; This will cause an error
    double radius = 10;
    double circumference = 2 * PI * radius;
    std::cout

  • @cazz
    @cazz 2 роки тому +15

    For people who aren't aware... the const keyword is contextual. Const before a variable makes it constant, but const after a function declaration in a class makes it so that the method can be called with a const object. Anyway, good video!

    • @BroCodez
      @BroCodez  2 роки тому +16

      that's true, however I haven't explained functions and classes yet. I didn't want to make it more confusing.

    • @cazz
      @cazz 2 роки тому +5

      @@BroCodez All good my man. I understand the challenge of trying to teach concepts like this without complicating it, especially in such a hefty language like cpp.

    • @montyferguson4657
      @montyferguson4657 2 роки тому +2

      @@BroCodez I'm currently doing classes, polymorphism, inheritance, composition, operator overloading, and templates.

    • @BeatRunner69
      @BeatRunner69 Рік тому

      @@montyferguson4657 I'm currently doing your mum, your dad, your grandpa, your grandma, your great grandma, AND your great grandpa.

  • @kottln
    @kottln 2 роки тому +18

    since i arrived early it's likely that you'll read this, you've taught me almost everything i know about programming, really easy to understand videos, keep it up man

  • @jamesmiller9923
    @jamesmiller9923 2 роки тому +10

    While taking notes on this video, I included: const double Gravity = 9.8 ;
    I just started teaching myself programming this week, using c++ and just on command line. Even though my interface is less intuitive than yours, this playlist has been a huge help for daily studying. I can see myself referencing these videos for a long time.

    • @ahmed.p123
      @ahmed.p123 9 місяців тому +3

      Write GRAVITY like this is better 💖

  • @dawidbakkes9908
    @dawidbakkes9908 7 місяців тому

    Your series is super insightful and I am enjoying learning this so much!
    #include
    int main () {
    const double PI = 3.14159;
    double radius = 10;
    double circumference = 2 * PI * radius;
    std:: cout

  • @gourish2
    @gourish2 11 місяців тому +5

    const string u = you are teaching good;

  • @Thisisdcode
    @Thisisdcode Рік тому +8

    constant: my knowledge of c++ even after watching the playlist about 12 times

    • @LXV304
      @LXV304 5 місяців тому

      Nice one! XDXD
      #include
      int main() {
      const std::string ThisisdcodesKnowledge = "The Same XD";
      std::cout :D

  • @ryancoopersnissan240sx8
    @ryancoopersnissan240sx8 Рік тому +1

    Im going off to a college soon, studying CE. A friend of mine reccommened your channel and it's been great so far, thanks for the great tutorial bro!
    here's my homework
    #include
    int main(){
    //The const keyword spectifies that a variable's value is 'constant'
    //tells the compiler that this value is off limits (prevent anything from modifying it)
    // effectively a 'read-only'
    double Torque = 318;
    Torque = 69; //75 years since last oil change
    int RPM = 5200;
    double Horsepower = Torque * RPM / 5252 ;
    std::cout

  • @cayden9224
    @cayden9224 2 роки тому +2

    Thank you so much for returning to UA-cam

  • @ethangordon3935
    @ethangordon3935 2 роки тому +1

    Hey man, love your stuff. Keep up the good work!

  • @rudrarajkar1116
    @rudrarajkar1116 2 роки тому +3

    as far as I think he never took a break. the time he did not upload he was making the videos he is uploading now. thanks bro :thumbsup: u truly r a chad
    #simp lol

  • @alessa004w
    @alessa004w 2 роки тому

    thx for all your great content man, helped me a lot keep it up

  • @fxs-_-3686
    @fxs-_-3686 2 роки тому +5

    #include
    using namespace std;
    int main() {
    const int daysPerWeek = 7;
    const int hoursPerDay = 24;
    const int inchesPerFoot = 12;
    const int feetPerMile = 5280;
    const int secondsPerMinute = 60;
    cout

    • @vexed3185
      @vexed3185 Рік тому

      can you use the std namespace out side the function? is it still work in the function?

  • @artemzakharchuk2842
    @artemzakharchuk2842 Рік тому +1

    #include int main { using namespace std; const int age = 16; const double mark = 9.5; const string name = "Artemius"; const char grade = '11'; cout

  • @MainulHossainAnik
    @MainulHossainAnik Місяць тому +1

    DONE BRO❤❤😌😌

  • @abduabdu7404
    @abduabdu7404 2 роки тому

    Hey bro Just finished your Java Gui course and wanted to ask if you can give me resources to study from and continue java

  • @gusgus1330
    @gusgus1330 Рік тому +1

    const int NUM_LEVELS = 25; // total levels in a game
    const double FREEZING_POINT = 0; // celsius
    const double BOILING_POINT = 212; // fahrenheit
    const int DAYS_PER_WEEK = 7;
    const int DAYS_PER_YEAR = 365;
    const char FIRST_INITIAL = 'G';
    const char LAST_INITIAL = 'B';
    const std::string FIRST_NAME = "Gus";
    const std::string LAST_NAME = "Burton";
    const bool IS_ALIVE = true; // gonna live forever obviously

  • @arooba6132
    @arooba6132 2 місяці тому

    you can use "using namespace std ; " after "include" instead of using "std::" in every line

  • @othmanqadasi4745
    @othmanqadasi4745 10 місяців тому +2

    الف شكر ياعمنا😘

  • @yavuzselimkepenek6064
    @yavuzselimkepenek6064 3 місяці тому

    1000th like woow.

  • @iliabarani6766
    @iliabarani6766 7 місяців тому

    noice

  • @ryanalnaser914
    @ryanalnaser914 2 роки тому

    whatever anything before or after or anything

  • @ahmaryarkhan1261
    @ahmaryarkhan1261 Рік тому

    #include
    using namespace std;
    int main()
    {
    const int daysPerWeek = 7;
    const int hoursPerDay = 24;
    const int minPerday = 1440;
    const int secPerday = 86400;
    const int daysPeryear = 365;
    const int monthsPeryear = 12;
    const int secPeryear = 31536000;
    cout

  • @Dr.Logistik
    @Dr.Logistik 2 роки тому +2

    #include
    int main(){
    /**
    The const keyword is used to define a variable that is CONSTANT and will not change
    IE C for example (Speed of light) does not change in physics.
    neither does g, 9.8 M/S/S
    Prevents the compiler from allowing changes, makes it essentially read only
    **/
    const double PI = 3.1415926535898; //Naming convention for constants is all upper case.
    double radius = 10;
    double circum = 2 * PI * radius;
    double areacir = PI * radius * radius;
    double area = 4 * PI * radius * radius;
    double volume = (4 * PI * radius * radius * radius) / 3;
    std::cout

  • @SudiptaBadhon
    @SudiptaBadhon 6 місяців тому

    Const double gravity = 9.8;
    Const std::string legend ="Brocode"

  • @antiquegaming551
    @antiquegaming551 2 роки тому +1

    hello bro

  • @theguyjawn
    @theguyjawn Рік тому

    //Euler's number
    const double E = 2.71828

  • @affanhossainrakib
    @affanhossainrakib Рік тому

    Algo Algo

  • @dzbanekkulka7424
    @dzbanekkulka7424 2 роки тому

    Earth's circumference = 40000km

  • @promax1st
    @promax1st 2 роки тому

    :)

  • @Sahan-od3vq
    @Sahan-od3vq 7 місяців тому

    420.69 is unexpected!!!

  • @AdmiralZanzky
    @AdmiralZanzky 26 днів тому

    const int FEET = 4;

  • @Nukebob3
    @Nukebob3 2 місяці тому

    const std::string ID = "amongus";

  • @vGrey
    @vGrey 2 роки тому

    const int LIGHT_SPEED = 299792458;
    const int WIDTH = 1920;
    const int HEIGHT = 1080;
    int sum = WIDTH + HEIGHT;
    std::cout

  • @antiquegaming551
    @antiquegaming551 2 роки тому +1

    reply bro

  • @HollowHangouts
    @HollowHangouts Місяць тому

    IM going to make pigs fly just need a big bird and some tape

  • @rajapandey773
    @rajapandey773 2 роки тому +1

    const char MY_GRADE='E';

  • @armomations5712
    @armomations5712 2 роки тому +1

    const double FEET = 12.0; huh who said that

  • @Yousif_Maksabo
    @Yousif_Maksabo 7 місяців тому

    const double e = 2.718

  • @PCgamers69420
    @PCgamers69420 4 місяці тому

    const double gravity = -9.81;

  • @mgames3209
    @mgames3209 2 роки тому

    12th

  • @hong-jisoo
    @hong-jisoo Місяць тому

    const int G = 9.8;

  • @Sujal_Humagain
    @Sujal_Humagain 7 місяців тому

    const double gravity=10;

  • @armomations5712
    @armomations5712 2 роки тому

    const double BIRTH_DAY = 1.26

  • @JEEVISAKTHI-pe8hr
    @JEEVISAKTHI-pe8hr 10 місяців тому

    const int e = 2.71;

  • @kartikchauhan5209
    @kartikchauhan5209 Рік тому

    const double GRAVITY = 9.8 ;

  • @theplet4414
    @theplet4414 2 місяці тому

    const double GIGA_CHAD_HEIGHT = 6.8;

  • @dakshagrawal2822
    @dakshagrawal2822 3 місяці тому

    const double e = 2.71;

  • @renealbrechtsen9743
    @renealbrechtsen9743 Рік тому

    const std::string API_KEY = "some api key here";

  • @JayChit
    @JayChit 10 місяців тому

    const std::string = "fart"

  • @Garrison86
    @Garrison86 2 роки тому +1

    This one might be an obvious one: const int TAX_GST = 13;

  • @lazbeetle
    @lazbeetle Рік тому

    const int android_ver = 9

  • @Madsun262
    @Madsun262 3 місяці тому

    const int AMOUNT_OF_BITCHES_THIS_GUY_GETS = 999999

  • @DerleMixon
    @DerleMixon 7 місяців тому

    const int BEINS_SIZE = 5;

  • @mrcrispycato1311
    @mrcrispycato1311 Рік тому +2

    const double Money_in_my_bank = 00.00; 😔

  • @oltenutu
    @oltenutu Рік тому

    const std::string DATE_BORN = "dd/mm/yyyy";

  • @bsh3973
    @bsh3973 2 роки тому

    System.out.println(" random comment for ");

  • @mouni6726
    @mouni6726 4 місяці тому

    const double GRAVITY = 9.8;