VB icon

ASCII to Decimal, Hexadecimal, and Octal

Email
Submitted on: 1/4/2015 10:39:00 PM
By: Eric K (from psc cd)  
Level: Beginner
User Rating: By 6 Users
Compatibility: C, Microsoft Visual C++
Views: 8013
 
     This program will convert ASCII to decimal, hexadecimal, and octal.

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: ASCII to Decimal, Hexadecimal, and Octal
// Description:This program will convert ASCII to decimal, hexadecimal, and octal.
// By: Eric K (from psc cd)
//
// Side Effects:I am a beginner C/C++ coder so the code is probably messy and disorganized. Any feedback/suggestions is welcomed!
//**************************************

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main()
{
	char string[1024];
	int length;
	printf("ASCII Input: ");
	gets(string);
	printf("\n");
	printf("\n");
	printf("Decimal Ouput:");
	for(length = 0; length < strlen(string); length++)
	{
		printf("%d ", string[length]);
	}
	printf("\n");
	printf("Hexadecimal Output: ");
	for(length = 0; length < strlen(string); length++)
	{
		printf("%x ", string[length]);
	}
	printf("\n");
	printf("Octal Output:");
	for(length = 0; length < strlen(string); length++)
	{
		printf("%o ", string[length]);
	}
	printf("\n");
	printf("\n");
	system("pause");
	return 0;
}


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.