C++ :: How To Convert Characters To Hex Format
Oct 4, 2014
Is my understanding correct?
Ascii 'a' = 61 (Hex)
Ascii '0' = 30 (Hex)
So this is how we convert characters to hex.
Integer 0 = 0 (Hex), because it's not a character but an integer.
View 8 Replies
Feb 23, 2015
I have been skimming and searching but dont know how to word the search just right to find what I need to know. I have written simple stuff with the support of tutorials like weight conversion or loops counting up to a set number. Nothing amazing. The other day I found out how to input and print a string rather than a single text character which i though was bad ass. I even got it to read multiple strings on a single line and found a way to read multiple lines. I can even format it to read both integers and characters on the same line as long as I know the predefined format.
On to my question... How do I read multiple lines with both carecters and integers. for instance:
nissan 1996
toyota 1998
or more comples like
nissan gtr 1996
toyota markii 1998
I want to use
int year;
char make[10]; maybe need to use char make[10][10]; for an array i would guess.
char model[10]; optional for the extra data
but reproduce what i read in a different order. say...
1996 nissan
1998 toyota
vice the original format.
this is what I have tried.
Code: scanf("%s %s", &make,&year);
//The way I seen to read multiple lines was on here
scanf("%[^/t]", %make);
But this wont let me separate the two into two differnet definded data types. Let alone use printf to display them in reverse order.
View 1 Replies
View Related
Apr 25, 2013
a few pointers in building an assembler in C for a 68hc11 micro controller I'm struggling on a way to convert the assembly language in a txt file to s19 format.
View 1 Replies
View Related
Oct 14, 2014
I wanted to write a program to convert a number into a more readable format. It's like, if the input enters the number as 2361263 the output should be like 2,361,263. I went about this problem like extraction the number first and then if the count was equal to multiple of three i'd print ',' instead of the number.
But initially when i wrote the code for extracting a single digit from the number
Code:
#include<stdio.h>
void main() {
unsigned long long num=pow(2,50);
int count=0;
while(num!=0) {
int last_digit;
[Code]....
I know that I'd lose the number when i finish printing it, but still I only end up printing the entire number in reverse order.
As in if the input is 1234 the output is 4,321 which is not what i want.
One way of overcoming this problem is to store the values in an array and then reading then back from the end. But i wanted to know if there is a better solution than this? To extract the digits from the number in the same order as it is in the number
View 5 Replies
View Related
Jun 13, 2013
I have total time in seconds (say 2500 seconds). I want to store this time in CTime or CTimeSpan format.?
How to do this.?
View 2 Replies
View Related
Jun 8, 2013
How do I convert date in integer format to DateTime without using DateTime?
I have tried:
Regex regex = new Regex(@"^(0[1-9]|1[012])(0[0-9]|1[0-9]|2[0-9]|3[01])(1[789]|[2-9][0-9])dd+$");
if (regex.IsMatch(txt_fromdate.Text) == true)
{
DateTime dt = DateTime.ParseExact(txt_fromdate.Text, "MMddyyyy", null);
}
View 1 Replies
View Related
Jan 19, 2014
I have almost a hundred names in a text file that I want to convert to email addresses and save to another file. I seem to have it working, but it doesn't print the full names in the email prefix. The output I'm looking for is Doe_John@livebrandm, but I'm only getting D_J@livebrandm. I'm not sure what I should specifically be reading up on that applies to this directly.
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
FILE *fpin=fopen("namesIN.txt", "r");
FILE *fpout=fopen("emailOUT.txt", "a");
char first[20],last[20],inbuff[1500];
[Code]...
View 9 Replies
View Related
Nov 22, 2013
The code is supposed to convert characters from an array into their respective ascii integers, and append a 0 if the number is less than 3 digits long. It then supposed to put it all together into one string.
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
char file[] = "This is a test";
char *ptr = file;
int length = strlen(file);
int i, numbers[length];
[Code] .....
View 4 Replies
View Related
Jun 8, 2014
heres the function:
string ToString ( const char * format, ... )
{
char buffer[256];
[Code]....
these function do the same of the sprintf() function. but instead we use a variable for add the result, i want to return the result. when i use it:
string f;
f=ToString("hello world");
gives me several errors:
"error: crosses initialization of 'std::string f'"
"error: jump to case label [-fpermissive]"
View 7 Replies
View Related
Apr 15, 2013
How would you convert say "238273615237287352536266362524382737272" base 10 to a base x number contained within a string of characters?
View 2 Replies
View Related
Mar 20, 2014
so my question is i want to print characters,no string just an array of characters,i do this but it s not working,maybe i have to put the '' at the end?
Code:
int main() {
int i;
char ch[5];
for(i = 0; i < 5; i++) {
scanf("%c",&ch[i]);
[Code]...
View 6 Replies
View Related
Jul 6, 2014
Im supposed to find the common characters between two string characters, assuming that the user wont input duplicate letters like ddog. When I run my code I get an output of a question mark upside down. Here is my code with comments on what each part is supposed to do
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
char str1[20], str2[20],remp = '