65.9K
CodeProject is changing. Read more.
Home

Base To Base Converter

starIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIconemptyStarIcon

1.25/5 (4 votes)

Aug 12, 2004

viewsIcon

42651

downloadIcon

810

The project converts numbers from one base to another - windows forms front end

Introduction

This small .NET windows forms project contains a function which converts a user-entered number from one base to another. Within this context the function takes a number stored as a std::string but would easily be edited to take an integer etc. if required.

Using the code

convdef.cpp and convheader.h comprise the conversion function with arguments std::string thestlstring, int base & int base2 - it returns the converted number stored as an std::string.

Points of Interest

I have been learning standard c++ for about 18 months and this project was an excuse to try making a little graphical front end for my conversion program which was originally a console program. What took me some time, being completely new to .NET, was converting the managed string which was the user-entered original number to an std::string - I found the two functions ManagedToSTL and STLToManaged somewhere on the web after much searching - they are defined in Form1.h of my upload if of any use to you.