Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 25th, 2008, 03:05 PM
Registered User
 
Join Date: Jan 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default need help with creating a base conversion program

hello if you have any idea on how i should modify the remainders of my program to convert from base 10 to base 2 can you help me please
:(

Reply With Quote
  #2 (permalink)  
Old April 11th, 2008, 03:27 PM
Registered User
 
Join Date: Apr 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

#include<iostream.h>
#include<math.h>
void main()
{
    int decimal,binary = 0;
    int remainder,i=0;
    cout<<"\nEnter decimal number:";
    cin>>decimal;
    while(decimal>0)
    {
        remainder = decimal % 2;
        decimal = decimal / 2;
        binary = binary + remainder * pow(10,i);
        i++;
    }
    cout<<"\nThe binary output is :"<<binary;

}

This is a simple program to convert from decimal to binary... I can't exactly understand your question... Any doubt ask ill tell...

#9835;...Vikki...#9835;
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating binary file compatible with other program wakeup ASP.NET 2.0 Basics 0 October 16th, 2008 03:03 AM
Creating Access Data Base file using VS 2005 wjbauer BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 November 3rd, 2007 04:40 AM
PROGRAM FOR DECIMAL TO BINARY CONVERSION bharathidhas C# 1 December 13th, 2006 02:53 AM
Setup Project: Program not added in Start>Program arif_1947 VS.NET 2002/2003 2 March 31st, 2005 06:40 AM
Start a program inside another program Silje Classic ASP Professional 1 November 16th, 2004 02:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.