If I have an integer in c that represents the date how do I print out the actuall mm/dd/year?
64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 ... |
hi i wanted to convert the argv in ansi-c into int. i am not sure of a few things...
int main(int argc, char* argv[])
let's assume my program is run as follows ... |
How to convert integer to hexadecimal in C?
|
Actually I've (probably) a "simple" problem. So I don't know how to cast a signed integer to an unsigned integer.
My code :
signed int entry = 0;
printf("Decimal Number : ");
scanf("%d", ...
|
I have an error with this codie.
'midiInGetID' : cannot convert parameter 2 from 'int *' to 'LPUINT'
What does int * and LPUNIT mean?
struct midi_in_list_node
{
int midi_in_number;
...
|
I am writing a program with GNU Bignum and what i want to do is simply read a binary file, and use the raw data as a Bignum integer, But whenever ... |
I have a scenario where the I get a Base64 (64 bit encoded) string. My requirement is to convert this string to gmp integer (mpz_t).
But according to ... |
|
I'm new to C and I have been reading concepts and example code in a book titled "C Programming in easy steps".
So, I type in this example program, character for ... |
I would like to pass a signed int to gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n). The signed int that I'm passing is greater than or equal to zero. ... |
I am trying to convert 65529 from an unsigned int to a signed int. I tried doing a cast like this:
unsigned int x = 65529;
int y = (int) x;
But y is ... |
|
Dexter wrote, On 20/03/08 08:09: Recently on a coding test , I was given a problem to write a program that converts an integer to any given base between 2 and 16 (inclusive). I had written it in C# as this code is available to I think you took a wrong turning somewhere. This is comp.lang.c, you will find the ... |
I have a bunch of strings in a database that have in them a number I want to extract. Here's the example code I've been working with: AnsiString tmp = "AMjsdfdsdfj 457756 some description"; int firstDelim = 0; int secondDelim = 0; for(int i=0; i<=tmp.Length(); i++) { if(IsDelimiter(" ", tmp, i)); { if ( firstDelim == 0 ) firstDelim = i; ... |
|
Hi, Consider following piece of code: int i = 0x12345678; char c; c = i; printf("0x%x\n",c); What value will be printed ? As per K&R, longer integers are converted to shorter ones by dropping the higher order bits. So, value printed should be "0x78". However, my question is that can this value be different on machines with different endianness ? thanks ... |
Kio wrote:[color=blue] > For example: > > 1 __int64 fib4(__int64 n) > 2 { > 3 if ((n==1) || (n==2)) return 1; > 4 else return (fib(n-1)+fib(n-2)); > 5 } > > How to avoid conversion to int in line 4 ??[/color] Hard to tell: '__int64' is not a standard type and the rules set up for the type are thus ... |
We've started to use a coding standards checker at work. The following code results in a warning: 38: CPlainText::CPlainText(const char *szPath,bool bTimeStamp,bool bSaveLast) 39: :CLog()//call base class constructor to initialize members 40: { 41: 42: m_bTimeStamp=bTimeStamp; 43: try 44: { 45: 46: 47: if( true == bSaveLast ) ^ Msg(2:3051) Be aware that an implicit conversion from 'bool' to 'int' takes ... |
|
|
#include #include #define MAXSTRING 100 int main() { char c,name[MAXSTRING]; int i, sum = 0; printf("\nhello! What is your name? "); for (i = 0 ;(c = getchar()) != '\n'; ++i){ name[i] = c; if (isalpha(c)) //sum += c; sum += (c - 96); } name[i]='\0'; printf("\n%s%s%s\n%s", "hi ", name, ".", "Your name spelt backward is "); for(--i ; i >=0 ... |
|
Can anyone give me somewhere to start if I have to convert from Roman Numeral to decimals? M - 1000 D - 500 C - 100 L - 50 X - 10 V - 5 I - 1 that if the user inputs CD - 400 MD - 1500 IX - 9 MXIII - 1013 I just need a rough guide ... |
|
Code: this is my program, the input for time in and time out is string because of the colon e.g. 08:00, and if possible i also want to store the time in and time out in the file day.txt ex. 08:00,17:00,17:30,17:30,08:03,17:00,17:30,17:30,08:00,12:00,17:30,17:30,07:45,17:05,17:30,17:30,07:59,17:20,17:30,17:30 pls. kindly check my work. tnx #include #include main() { FILE *fptr; char x[5][9]={"Monday","Tuesday","Wednesday","Thursday","Friday"}; int i,y,a[5],b[5],total=0,total1=0; char a1[5],b1[5]; fptr =fopen("day.txt","a"); ... |
|
Well, I don't know about the probability, but if the alignment restriction holds, only one out of every 4 possible char addresses is a valid int address (if sizeof(int) == 4). Typically it would be just those addresses that are divisible by 4. For example, on my machine the output of Code: #include int main() { double d; std::cout << ... |
Hi! I have: char str[100]; int temp; I use fgets to read in like [2 3 +]. When i = 0, str[i] points at the character 2. How can I get temp to be 2?? temp = str[i] don't work because str[] is declared as a char. temp gets another value than 2! HOw do I convert what str[i] is pointing ... |
|
You might try fixed point numbers. What you do, is you set aside a number of binary digits in an integer for the decimal point accuracy. ie: 32 16 8 4 1 | decimal point | 1/2 1/4 1/8 1/16 1/32 Addition and subtraction of fixed point numbers are just the same as that for regular integers. When you divide a ... |
Before I begin. I think a class is different than a function. Classes are something in C++. All I can offer you is a function that demonstrates an algorithm for taking a string which contains a hex number and returns the decimal value. Code: int htoi(char s[]) { int decimal_val; int result = 0; int i; /* Goes through each value ... |
Hi, Using Visual C++ (VS 2010). I am pulling a string out of the registry and trying to convert it to an integer, however, the value keeps changing. Its a timestamp, and I want to do some math with it. Basically its coming out as 1290006451, but when I change it to an int with (int) or atoi(), it turns into ... |
Can anyone give me somewhere to start if I have to convert from Roman Numeral to decimals? M - 1000 D - 500 C - 100 L - 50 X - 10 V - 5 I - 1 that if I write CD - 400 MD - 1500 IX - 9 I just need a rough guide on how to do ... |
|
unsigned long iptol(const char *ip){ unsigned long value = 0; /* Total Value */ unsigned char ocet = 0; /* Ocet Value */ int i = strlen(ip) - 1; /* Index in ip */ int m = 1; /* Ocet multiplier */ int j; for (j=0; j < 4; j++){ while ( ip[i] != '.' && ip[i] != '\0' ){ ocet ... |
|
|
|
|
hi!! i want to convert a string to int.. but i guess the value is bit too long to be stored as int....so i want to store it as unsigned int...but cant figure out how to make this conversion.. #include #include int main() { int inbytes1; char string[50]="265695678"; printf("string %s\n", string); inbytes1 = atoi(string); printf("int: %d\n", inbytes1); } regards ... |
Hi, I have a while loop that is going through a whole lot of numbers and doing calculations on them. 49493 returns 29 for example because if you do 4 + 9 + 4 + 9 + 3 you get 29. Therefore I want to create a file called 29.txt and add 49493 to it, and be able to add any ... |
#include #include #include #include void inttobin(int c) { char * s ; char * p ; size_t n = 8*sizeof(unsigned int); p = malloc(n*sizeof(char)); while (n-- > 0){ s = ((c >> n) & 1) ? "1" : "0"; strcat(p,s) ; } printf("%s",p) ; } int main() { inttobin(0x1234567) ; } |
I have written the following Code which will convert an integer number to a roman..I have a array list of integer number which I pass through a for loop and the return value is individual converted Roman character.. My Issue is when the converted value is returned from the function I want to capture it in another character array one after ... |
__int64 r; unsigned int milliseconds_1; unsigned int milliseconds_2; unsigned int milliseconds_3; r = 0x123456789; milliseconds_1 = (unsigned int)(r & 0xffffffff); //#1 milliseconds_2 = (unsigned int)r; //#2 milliseconds_3 = r; //#3 Actually if you run this code in visual studio, will works without any error or warning. #1 and #2 is exactly same. But #3 is ... |
|
i am using fgetc to read from a file.also my project uses a double link list here is a sample of my program c=fgetc here is the rest else if (isdigit(c))//this use to delete from the link list { //delete(); //del=atoi(c); ... |