473,766 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to convert a base 8 number into decimal number... help me pls thks

8 New Member
pls help to solve this problem : using C programming to convert a base 8 number into a decimal number... thks
Nov 16 '06 #1
4 2677
Banfa
9,065 Recognized Expert Moderator Expert
Do you mean a string containing a base 8 number?

C/C++ only operates in 1 base, base 2 (binary), all other bases are just input/output notations because humans find binary a little hard to read.
Nov 16 '06 #2
c2h
8 New Member
Hi, Banfa... thanks for your reply. I also not very sure. But the question is : using a appropriate programming language, write a program that convert a whole number input by the user from base 8 to base 10. The program should flag as an error any input that contain 8 or 9.

i very appreciate ur reply. can u suggest for me what else programming language is appropriate to this question.. ? thanks
Nov 16 '06 #3
Banfa
9,065 Recognized Expert Moderator Expert
A-ha the real specification always helps.

So you need to convert an ASCII string of digits to a binary value assuming that the string of digits is given in base 8.

The is a function in the standard library that will do this without too much hassle

long strtol ( const char * string, char** endptr, int radix );

Look it up, it is declared in stdlib.h
Nov 16 '06 #4
c2h
8 New Member
haha.... thankyou.... actually i not very understand, but i will try to find it out...
thanks you a lot
Nov 16 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2576
by: ferran | last post by:
Hi, does anybody know how to convert in C++ from base 10 to any other base without loosing the decimal part of the actual value? I came up with this algorithm to convert from decimal to any base but I'm not sure what to do to include the decimal part. //----------------------------------------------------------- const char ccBaseChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; char sResult = {0}; int iBase;
13
41818
by: Hako | last post by:
I try this command: >>> import string >>> string.atoi('78',16) 120 this is 120 not 4E. Someone can tell me how to convert a decimal number to hex number? Can print A, B, C,DEF. Thank you.
4
9768
by: aevans1108 | last post by:
expanding this message to microsoft.public.dotnet.xml Greetings Please direct me to the right group if this is an inappropriate place to post this question. Thanks. I want to format a numeric value according to an arbitrary regular expression.
7
7121
by: whatluo | last post by:
Hi, all I'm now working on a program which will convert dec number to hex and oct and bin respectively, I've checked the clc but with no luck, so can anybody give me a hit how to make this done without strtol or s/printf function. Thanks, whatluo.
13
5595
by: muss | last post by:
how to convert decimal number in a hexadecimal number using C? Please help me. Thanks.
2
1495
by: c2h | last post by:
pls help me to solve this problem : using VB to convert a base 8 number into decimal number ..... thks
1
2696
by: ahoway | last post by:
I am working on a program where I have to enter a decimal number and enter a base and it converts according to base. output: Please enter a decimal number to convert: 15 <-input What base would you like to convert to?(2-16)? 2 <-input Decimal number converted to base 2 number is: 1111 <-output Thank you
6
16919
by: sweeet_addiction16 | last post by:
hello Im writin a code in c... can sum1 pls help me out in writing a c code to convert decimalnumber to hexadecimal number.The hexadecimal number generated has to be an unsigned long.
8
3671
by: te509 | last post by:
Hi guys, does anybody know how to convert a long sequence of bits to a bit-string? I want to avoid this: '949456129574336313917039111707606368434510426593532217946399871489' I would appreciate a prompt reply because I have a python assessment to submit. Thanks, Thomas
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10008
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.