code to convert from desimal to hexsa desimal

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • walaetoom
    New Member
    • Nov 2009
    • 1

    code to convert from desimal to hexsa desimal

    i want to write program that show how memory saved the floating number and calculate the speed of computer to print 1000 floating number
  • whodgson
    Contributor
    • Jan 2007
    • 542

    #2
    Addressing your title:
    I think they are called 'format manipulators'.
    Code:
    int n=15;
    cout<<hex<<n;// will print f or F.
    // or
    cin>>hex>>n;//will input f or F.
    For the rest you would need to post some code with specific queries to obtain further assistance.

    Comment

    • RRick
      Recognized Expert Contributor
      • Feb 2007
      • 463

      #3
      To figure out how long it takes to convert the numbers, you have a couple of options. The simplest way is to just get a stopwatch out and time the program. In linux, the date function works well, but has a low resolution of only seconds. For this to work, you need to run a lot more than just 1000 conversions.

      You can also check run times from within the program. In this case, you'll need a system routine that works with time. On windows, GetSystemTimeAs FileTime works and on linux, try gettimeofday. You still have to figure out how to subtract one time from another.

      Comment

      Working...