How to Program A Calculator in C++! (Great C++ Microsoft Visual Studio Beginner Project)

Поділитися
Вставка
  • Опубліковано 11 гру 2024

КОМЕНТАРІ • 65

  • @VirtualizerExtreme
    @VirtualizerExtreme Рік тому +22

    Many thanks! I wanted to make a C++ calculator for my dad since I have coding classes with him.
    Oh and also I added exponents, square roots, logarithms and sines to make it more inclusive, again, many thanks!

  • @beatlessteve1010
    @beatlessteve1010 Рік тому +6

    Watched your entire lesson, and was hoping for a calculator using Windows forms where we have an actual representation of a calculator, however, I really found this to be a great lesson.. I could have almost got by reading your comments and figuring the coding out because they were that descriptive. So far I am really happy with what I have learned from your video..thanks.

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

      Hi! Glad it was helpful! I do think a lot of people could benefit from a tutorial on windows forms with C++ (I did one with C# that alot of people liked) and so maybe I'll do that soon too!

  • @uwlight9154
    @uwlight9154 2 роки тому +4

    ahhh thanks so much had to work with logs and ln and this helped alot when im online instead of in person

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

      Glad it helped! Welcome to the channel!!

  • @saadpatel5128
    @saadpatel5128 6 днів тому +2

    bro u could use switch case instead of if else block it will be more easier and less code

    • @lemastertech
      @lemastertech  6 днів тому +1

      very true! Good optimization suggestion

  • @carinasittner6669
    @carinasittner6669 5 місяців тому +1

    Thank you very much for your work, I am learning c++ and this is going to be very useful to me. You earned a subscriber and a like.

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

      You’re super welcome thank you for watching!!

  • @Lefodhs_Exarchos
    @Lefodhs_Exarchos 3 місяці тому +2

    Actually if you want to make the calculator to perform more calculations -as many as the user wants- you can use a while loop and a condition for more or not calclulations

  • @NickShawn-x7f
    @NickShawn-x7f 6 місяців тому +3

    Please can you teach us on how to make a gui for this type of calculator?

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

      Hi I did a few GUI tutorials for things using winforms and a lot of gui tutorials using python including one on how to make a calculator gui!

    • @NickShawn-x7f
      @NickShawn-x7f 5 місяців тому

      @@lemastertech but can you please make one for this C++ tutorial 🙏 😫 😢 😔 😭

  • @curiousity271
    @curiousity271 2 місяці тому +1

    Thanks a lot for your tutorial. Can you make a tutorial of how to package this as an app to use any computers, please? Thanks.

    • @lemastertech
      @lemastertech  2 місяці тому +1

      That’s an interesting idea! I’ll see if I can get the time to do that soon!

  • @NickShawn-x7f
    @NickShawn-x7f 6 місяців тому +2

    Thanks so much for this video. It helped a lot.

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

      I’m glad it helped you’re very welcome!!

  • @mikaelseno9670
    @mikaelseno9670 2 місяці тому +2

    CalculatorCeplesPles.cpp: In function 'int main()':
    CalculatorCeplesPles.cpp:33:1: error: expected ';' before '}' token help

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

      Put the semicolon after the curly bracket instead, looks like a syntax error!

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

    Appreciate the work you put into these videos, nice job

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

      Thanks Dale, we're getting closer to some cool C++ projects! Just making sure to get some of the foundations in place :)

  • @ArsenicDeath
    @ArsenicDeath 4 місяці тому +2

    How would you loop it? Like which condition has to be true in order to loop it?

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

      You could just do a “while input != “exit” or some other trigger condition, then run the calculator routine, and when someone types exit or closes the program it would end!

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

      @@lemastertech Thank you!

  • @Thundeger
    @Thundeger 21 день тому +1

    Sir, you should use switch&case to make calculator i think😊

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

    I have a question what is the goal of using (cmath) librarie and can thr code still work with out it?

  • @NickShawn-x7f
    @NickShawn-x7f 4 місяці тому +2

    I really need gui tutorials on c++

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

      me too, all I had is sfml GUI but I want to enhance the looks a bit like a android calculator

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

      I honestly hate building guis with C++ so I prefer to use C# or Python but I could try and look into making some tutorials for it in the future!

    • @NickShawn-x7f
      @NickShawn-x7f 4 місяці тому

      @@lemastertech ok sir thanks so much

  • @Corzal
    @Corzal 5 місяців тому +2

    how i know im learning is cause i managed to add error checks by myself lol (yes i know its not a lot but i just started)

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

      That’s awesome you should be really proud of that progress!! Nice job!!

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

      @@lemastertech thank you!

  • @schizoponk
    @schizoponk 10 місяців тому +1

    Can't you use switch to check that all instead of a bunch of else if's?

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

      Yes you can! And probably should - I was trying to make this ultra clear for beginners though!

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

      both works the same. where switch function is faster and looks clean than else if's in small programs like this a decent calculator

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

    Okey what happens if user wants to calculate more than two numbers

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

      You can use a new input for “total number of variables” and then iterate through a for loop or something like that

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

      @@lemastertech but do i have to have total number count before calculation? In a real calculator user doesn't enter that.

  • @herrobriam
    @herrobriam Рік тому +4

    you should use switches rather than if statements

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

      Yeah I try to cover one concept per video since a lot of my viewers were totally new to C++. I want to do a separate video on switch case stuff instead of adding it here, but good point, thanks for the feedback!

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

      Yeah, for me I would have used a char instead of string for the operation token and a switch statement as well as my own functions, but since I don't know what his series is or where they are I understand keeping it simple for beginners.

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

    howd you open that debug terminal?

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

      Sorry I’m not what you mean by debug terminal! In visual studio when you run a program that has console outputs or inputs it should open automatically!

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

    Yay i did it

  • @NickShawn-x7f
    @NickShawn-x7f 4 місяці тому +1

    I meant on c++

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

      No worries, I responded to your other comment!

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

    Thanks for this it's really helpful. I was wondering how to now build this program and turn it into a proper application with an executable that I can send to a friend and have it still work on their computer or is that too advanced for where I'm at now?

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

      Hi! That’s a good project idea, I have already done a tutorial in how to make a python project to an executable but I will plan on doing a C++ to executable tutorial soon! It is hard and there’s a lot of specific syntax you need to know but I’ll add it to my list for future projects!

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

    string operation;
    double x, y;
    cout > x;
    cout > operation;
    cout > y;
    if (operation == "+") {
    cout

  • @Auliaa_a
    @Auliaa_a 4 місяці тому +1

    Please source code

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

      Hi this project is only a few lines of code so I didn’t make a github for it

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

    Clickbait . No graphics like in photo of the video

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

      It’s absolutely not clickbait it is how to make a simple calculator program in C++ did you want the thumbnail to just be a screenshot of code lol

  • @DNautSun
    @DNautSun 5 місяців тому +4

    If you use libraries you actually dont know what your doing

  • @gohasan
    @gohasan 5 місяців тому +6

    Thank you very much for your work, I am learning c++ and this is going to be very useful to me. You earned a subscriber and a like.

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

      Thanks for watching and for that super nice comment! Glad to have you here!!