C Video Tutorial 14

preview_player
Показать описание

In the last part of my C Video Tutorial, I covered how to convert from base 10 to base 2, base 8 and base 16 with C.

At the end of that tutorial, I provided a homework assignment for you to write code that converts from any base back to base 10. In this tutorial, I will walk through exactly how to do that.

You can find all of the code above. Please leave any questions you may have.
Рекомендации по теме
Комментарии
Автор

You can use the command line just like I'm using. Watch the first video in my playlist for this tutorial. I show you how to set up everything on Windows and Mac.

derekbanas
Автор

Tôi rất hạnh phúc khi nghe điều đó. Ngôn ngữ như C cho bạn thấy bao nhiêu lập trình vui vẻ có thể được. Tôi sẽ sớm giới thiệu cách sử dụng nó để thực hiện các dự án điện tử thế giới thực mà bạn có thể sử dụng ra khỏi máy tính của bạn. Tôi vui mừng bạn đang thưởng thức các đoạn video.

derekbanas
Автор

Absolutely I plan on covering JEE. I'm just having fun with this tutorial. I have always found C to be fun to play with. I think programming has moved too far away from being fun and too much toward just getting a job. I hope there is room for both :)

derekbanas
Автор

0:33 "so, BASE-ically in the last tutorial" I see what you did there ;D

jennywang
Автор

I definitely need to make my tutorials more fun. I'm working on a super fun python tutorial

derekbanas
Автор

I know a little bit of a few languages, but I mainly use a translator

derekbanas
Автор

I think that's the main problem with learning programming. The idea should be to focus on fun, and persist, and you will gain your result. I think you need to cover a tutorial about that, and it should be your hardest so far :)

dedantemon
Автор

i would like to use a scanf to insert the number i want to convert. but im having trouble getting/saving the number of bites the string is to a variable(I will need the number of bites during the conversion).when I make the string I could set the number of bites
(char num[8];) but that limits the numbers that can be used and I would have to put some sort of stop in there for if some one puts a number over or under the set number of bites. so i would prefer to not limit the number of bites. I could ask the person who is inputting the data how many bites the number would take up as a string and I could make the char string using that data but i still have the issue of determining the number of bites they have inserted(they could say it will be 8 bites but input 9 or 7. so if there was a way to skip the prossses of asking the person the number of bits and just get the info from the scanf( ); statement i would prefer that but if cant then i have to find a way to determine if some one inputted the the wrong number of bits. and i have tried inputting a number
(1343) over the number of bites i set (char str[2];) and I printed out the number i inputted and the number was printed out exactly the same as i inputted it (1343 =5 bites)and i printed out number of bites the "str" was and it was still 2 bites. wierd. so what are my options? sorry its so long.

jonesjustin
Автор

Xin chào thân mến huấn luyện viên,

Tôi sử dụng để tránh ngôn ngữ C vì nó rất khó khăn.

Bây giờ video của bạn đang thay đổi tất cả.

Cảm ơn rất nhiều.

japanuser
Автор

For those with problem in compiling due to the error "undefined reference to `pow' ", add " -lm " option during compiling.

liujxing
Автор

I tried this example, for 1989 (base 10) and another big number. It work well for base 2, 8 and 16. But I tried converting from base 5 (30424) and base 15 (8c9) and instead of getting 1989 I got 1987 and 1988. And I am wondering why would it get it wrong for this bases? It is very strange.

emanuelkokovics
Автор

Yes CodeBlocks is very good I agree :)

derekbanas
Автор

Hi Derek, Have you put any thought into a full blown Java EE tutorial? Spring, JSF, Hibernate etc?

TheShagans
Автор

Hello, thank you for all your videos, and I mean all, unfortunately, I don't own a mac, but only a PC, and I would like to learn IOS Development, I was wondering, what to do, to compile and run c programs on my windows 8? (windows 8 :( ) I'de rather not use VS (already tried, didn't work for some reason) or a virtual machine, any tips? and if you ever run out of tutorial ideas, pygame ;)

pizzascript
Автор

Hello Derek Banas,
Could you tell me what's the usage of (number[i] -'0') in the baseToDecimal function?
If just use number[i] rather than (number[i] -'0') in the function, it definitely wrong but I don't know why.

Thank you !

davix
Автор

You can use CodeBlocks google CodeBlocks and download codeblocks-12.11mingw. Once it is installled click on "create new project" and then "new console project" make sure you click c and not c++ and you are good to go.

greywolf
Автор

Derek, I'm wondering how many languages do you speak?

Frasenius