-
March 24th, 2013, 07:07 PM
#1
using cout to display a scrolling screen of binary numbers
Hello all,
Can I do this? I realize that cout is just throwing data to the shell console. This is what I have for a routine that I want to call over and over again for decimal numbers 1 to 65535 (pseudo):
Code:
public static int bin(int in)
{
int binary = 0;
Do 'until quotient2 = 0
quotient2 = ROUND(dec / base2); //round this down.
remainder2 = dec Mod base2; //get remainder
binary = remainder2 + binary;
dec = quotient2;
If (dec == 0) {
break; }
Loop
bin = binary;
}
The thing that is key here is that the console produce the values at a certain speed because they're going to be presented like that during a presentation as a joke. I believe I can use the sleep() function for that, right?
Is there anyway to make this happen on a stand alone basis? for instance right now I'm using c++ VS 2010 and the only way I know to get printouts to the shell window is to compile the source files and run the exe.
I just want something similar to a small .bat that you can run through the windows shell. Can I get that with C++ or any other language to do this? I can probably google this but you guys are so awesome here you know, that it's worth asking here too!
thanks guys.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|