Тёмный

Count The Digits In An Integer Using Recursion | C++ Example 

Portfolio Courses
Подписаться 221 тыс.
Просмотров 1,7 тыс.
50% 1

How to count the number of digits in an integer number using recursion with C++. Source code: github.com/por.... Check out www.portfolioc... to build a portfolio that will impress employers!

Опубликовано:

 

11 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 13   
@leythecg
@leythecg Год назад
for me one of the best channels on u Tube in terms of C programming! Thanks a lot!
@PortfolioCourses
@PortfolioCourses Год назад
You're very welcome, I'm glad you're enjoying the channel! :-D
@octophrator1248
@octophrator1248 Год назад
Alternatively, count_digits could also be like this, if you don't want to use recursion: int count_digits(int number) { int p; for (p = 0; pow(10, p)
@PortfolioCourses
@PortfolioCourses Год назад
Thank you for sharing this! :-)
@karimbousmaha4038
@karimbousmaha4038 15 дней назад
Plz share a Playlist about making some games with graphics in c++
@bresent
@bresent Год назад
Can you make a playlist for graphics ? Like SDL or Raylib using C
@PortfolioCourses
@PortfolioCourses Год назад
Raylib is something I've had a few people request, it's something I've looked into a bit now. :-)
@jcamargo2005
@jcamargo2005 Год назад
While this is a great example on C, it is good to know that you can get this done with a single instruction in x86 architecture (LZCNT)
@PortfolioCourses
@PortfolioCourses Год назад
Thanks for sharing that! :-)
@MadpolygonDEV
@MadpolygonDEV Год назад
I think its cleaner to do this as recursion takes a while to read for me int count=0; While (number) { count++; number/=10; } return count;
@PortfolioCourses
@PortfolioCourses Год назад
I think so too. :-) Most of the time it's better to do things "iteratively" with a loop, rather than recursively. I make videos solving recursion problems because lots of teachers assign these to students to help them understand recursion, and the goal with the video is to help out the students that are struggling or stuck.
@MadpolygonDEV
@MadpolygonDEV Год назад
@@PortfolioCourses i see, your videos are amazing, thanks for all the content!!
@PortfolioCourses
@PortfolioCourses Год назад
You're welcome! :-)
Далее
Новый уровень твоей сосиски
00:33
Cursor Is Beating VS Code (...by forking it)
18:00
Просмотров 73 тыс.
Void Functions | C Programming Tutorial
5:38
Просмотров 1,4 тыс.