📚 Learn how to solve problems and build projects with these Free E-Books ⬇️ C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook 🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/ Experience the power of practical learning, gain career-ready skills, and start building real applications! This is a step-by-step course designed to take you from beginner to expert in no time! 💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10). Use it quickly, because it will be available for a limited time. #include using namespace std; void main() { //Count digits of a number int number; cout > number; if (number == 0) cout 0)//0 { //number = number / 10; number /= 10; counter++;//3 } cout
I appreciate you making all of these. I've been learning C# for the last 6 or so months but recently discovered all of my comp sci classes will be using C++ exclusively. You making these videos will have a huge impact on getting up and running for my classes. As I said before, I really appreciate it. Please keep pumping these out!
Thanks Austin, I will! :D If you have any friends that could benefit from these videos, please share them, It really means the world to me and it helps me a lot to grow my channel!
I wrote in order to include minus numbers too like that: while (number > 0 || number < 0) :) It works:) Thank you for the lessons :) It helps me a lot :) I am still learning:) And I like your videos so much :D
For those that want to have greater than 10 Digits, change your data type from int number to long long number. I was able to get 19 digits from this data type.
Pozdrav, obzirom da nisam bas za C++ svejedno se da nauciti a ucim vec druge programske jezike pa cu dati sansu da iskusam ovaj kanal. Dobila si novi sub
Sorry i have a question. What if there is a situation where user enters decimal number? I fried my brain trying to make some kind of a solution but nothing crosses my mind from the stuff we covered until this video. Is solution beyond this level of knowledge? Everything else in this video is very much clear. Thanks.
The question that you're asking is a pretty complex one, and if you really are a beginner, then you probably will fry your brain trying to understand, so I'll try to explain as simple as I can. There is one fundamental problem with this question, and that is how will you know when you should stop counting?! In order to understand what I'm talking about, please try to execute this program #include #include using namespace std; void main() { float number = 123.1; number /= 10; std::cout
Yes, I would love to see a video about debugging. But I do feel like the code we wrote at 14:35 was unnecessary and made the code longer, so I just did this while(number>0 || number
👍Added debugging video to ma TODO list. You proposed a very interesting solution, and it is correct. The code below is going to work for counting digits of both positive and negative numbers! Well done! Excellent! int counter = 0; while (number!=0) { number /= 10; counter++; } Notice that I just converted your (number>0 || number
A little different variation int num; int digit = 1; cout > num; if(num < 0) { num = pow(num, 2); num = sqrt(num); } while(num / 10 >= 1){ num/=10; digit++; } cout
Hey I find your programming vedios the most easiest ones, thanks and I really need a mentor like you please be my guardian. I what to learn C++ programming lang.
So how we can count more than 10 digits if that is all and int can hold? Unsigned int? Also since a negative number can be divided by 10 couldn’t we simply change the while loop to execute as long as the number is != to 0 as opposed to > 1 instead of taking the absolute value?
Woudnt it be more correct to state that the counter is really counting how many times the function can perform the operation(the act of dividing by 10), rather than saying that it's grabbing the last digit because it seems like that's what the modulo operation would do
Pozdrav, Zašto uopšte pišete dio u else{o množenju negativnog broja s -1} Je li se mogao while(number0) napisati ? Probao sam i meni lično radi pa ako možete molim Vas objasnite zašto taj korak sa else? Hvala :)
I think I found an alternative way to use negative numbers without the excess code or logic loops, what I did was for the while loop I put while(number != 0) and then the code, and that seems to work well, but perhaps doesn't work well elsewhere?\
Dear Saldana zero too have value is’t? When entering 0 it should show you it contains one digit is in it? Suppose the user enters other than digit will it convert and tell the digits?
I haven't seen that solution before, but you definitely can come up with different ways to solve the same programming problem. I'm glad to see different ideas and approaches in the comments! 🤓
i want to clear something that when i'm intentionally trying to overflow my code i am not getting 10 digits instead my code says contains 9 digits #include using namespace std; int main() { int number; cout > number; if (number == 0) cout
You can write most of the IoS app in C++, but if you don't already have a lot of code that you just want to reuse and you are doing it from scratch, I'd say a better choice would be Swift or Objective C.
Thanks CodeBeauty🤩 Even as a slow learner,I am able to catch up with ur videos. Hope you can include exercises to try at the end of video, just a suggestion from me hehe.
That is a good suggestion. Sometimes throughout the videos I give you tips on how you can improve and upgrade programs that we build, but I'm also going to try and include exercises at the end whenever possible. :D
i did exactly as you showed but my program wont compile. i enter nr 12 ,and it takes a LOT of time to get the result ...it "eats" a lot of memory and my laptop fan makes a lot of noise EDIT :: MY MISTAKE :))) i wrote while (nr > 0) { nr == nr / 10; OMGGGGGGGG
At 14:11 your solution to the negative number problem was inefficient in my opinion. I used an or logic gate in my while loop. Here's my code for the whole process here. *note I used n for number and c for counter. line 1 #include line 2 using namespace std; line 3 int main() line 4 { line 5 int n; line 6 int c = 0; line 7 cout > n; line 9 if (n == 0) line 10 { line 11 cout 0 || n < 0) line 16 { line 17 n /= 10; line 18 c++; line 19 } line 20 } line 21 cout
Ma'am, can U please provide me a valid questions related to the C++ And I've send U a connection on LinkedIn...... If You have a.... Then plz send me a question