Decimal to binary converter help!
Ok i'm doing a decimal to binary converter with C# i know most of you don't know the language but it's very similar to C++ so please take a look
[CODE]
/*The equation to convert Decimal to Binary is the following:
* *)Take the number in a variable called x
* 2)Get the remainder of x untill it's equal to * and put them in an array list
* *)Print the array backwards
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace NS
{
class Program
{
static void Main(string[] args)
{
// Take the number we would like to convert ....
int x = 0;
//The remainder will be here...
ArrayList arr = new ArrayList();
//End of variable declaration.....
Console.Write("Enter any number you would like to convert: ");
x = int.Parse(Console.ReadLine());
//Got the number now let's divide it untill it's equal 0 and pickup the remainders
for (int i = 0; x > 0; i++)
{
arr.Add(x % 2);
for (int s = 0; i < arr.Count; s++)
{
Console.WriteLine(arr[s]);
}
}
}
}
}
[/CODE]
I want the program to get the remainder of x untill x is equal to 0 and print the remainders :-) using an arraylist
** an arraylist is an object variable with no limits ... you can make an arraylist of integers and strings at the same time! So i'm using an arraylist to get all the remainders and print them backwards later (to convert to binary)
Also visit : [URL="http://www.helpwithpcs.com/courses/binary-numbers.htm"]http://www.helpwithpcs.com/courses/binary-numbers.htm[/URL]
to be able to help me , thanks! :)
Decimal to binary converter help
I am very thankful to ur reply but i actually i wan to compare one sound file to another in a some programming language. so if u have any idea please help me.
Another thing i wanted to ask is whether the code given by the binary converter is the actual way in which the sound file is stored in our system with the addresses same as given in the file in the converter?
You got the wrong idea i think
Look i'm not a real expert in binary convertions! And the converter i made above is a simple converter that could convert simple decimal numbers you put into binary for example : 5 it would convert it to *0* in binary!
I'm sorry but i can't help you on this one mate :(