View unanswered posts | View active topics It is currently Mon Dec 16, 2019 8:59 am






Reply to topic  [ 5 posts ] 
Binary numbers in RobotC 
Author Message
Rookie

Joined: Sun Nov 30, 2014 4:56 am
Posts: 14
Post Binary numbers in RobotC
Hello guys, I was just checking the question here http://www.robotc.net/forums/viewtopic.php?p=3144. But I was wondering if any changes happened and if there is something similar to <bitset> in C++ so I can print the binary representation of a number. Thanks for the help.


Last edited by billyb29 on Fri May 22, 2015 10:11 am, edited 1 time in total.



Thu May 21, 2015 10:54 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Binary numbers in RobotC
Hi there,

I think the only way you could print a binary number is by looping through the bits and printing them individually.

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri May 22, 2015 6:02 am
Profile WWW
Rookie

Joined: Sun Nov 30, 2014 4:56 am
Posts: 14
Post Re: Binary numbers in RobotC
Hello Xander,

So you mean if I have let's say a long long number, I would have to convert it to binary my self, and print the bits correct?

Nabil


Fri May 22, 2015 9:17 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Binary numbers in RobotC
Yeah, simply iterate through the number's bits, which you can print out individually, or store in a temporary array and then print.

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri May 22, 2015 11:13 am
Profile WWW
Rookie

Joined: Sun Nov 30, 2014 4:56 am
Posts: 14
Post Re: Binary numbers in RobotC
Thanks Xander, I really appreciate the help.

Nabil


Sat May 23, 2015 8:59 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.