×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

I need help making a simple program!

I need help making a simple program!

I need help making a simple program!

(OP)
I need to make the following program (i dont know how).

Read a 2 digit decimal number and display the 2 diged hexadecimal equivalent.  (this program neets to be in C++)

RE: I need help making a simple program!

Hi
hey this isn't some assignment is it?
try this it doesn't get much simpler
no error detection or anything...
hint don't enter a char just numbers if
you do you may have to control c out of it!

// dec to hex la very basic!
// Robert Dwyer
// use BC++ 5 as DOS or easywin

# include <iostream.h>
# include <iomanip.h>

void main(){

  int theinput1;
  int theinput2;
  int blat;

   cout << "Enter the  first number -> ";
   cin >> theinput1;
   cout << "Enter the second number -> ";
   cin >> theinput2;

   cout << "The Numbers as hex " << endl;
   cout << " First -> " << hex << theinput1 << endl;
   cout << "Second -> " << hex << theinput2 << endl;

   cout << "Enter Key to Exit";
   cin.ignore(128,'\n');
   blat = cin.get();

}

enjoy!

HTH

Robert Dwyer
rdwyer@orion-online.com.au

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close