Okay here's the program I have typed up(stdio.h is included also):
/* function main begins program execution */
int main (int argc, char *argv[])
{
int x; /*first number input*/
...
|
I've got a double... say
double d = 25.342;
How can I get the 25 value? ( If it were -12.46 I'd like to get -13)
Thanks!
Manuel
|
in Redis (http://code.google.com/p/redis) there are scores associated to elements, in order to take this elements sorted. This scores are doubles, even if many users actually sort by integers (for instance unix ... |
I am currently working on a project which involves searching&moving elements in graphs. I thought the igraph package was pretty good for my simple needs, however, as I am a ... |
I have a union as follows:
typedef unsigned long GT_U32;
typedef unsigned short GT_U16;
typedef unsigned char GT_U8;
typedef union
{
GT_U8 c[8];
GT_U16 s[4];
...
|
My apologies if the question seems weird. I'm debugging my code and this seems to be the problem, but I'm not sure.
Thanks!
|
What is the proper way to convert/cast an int to a size_t in C99 on both 32bit and 64bit linux platforms?
Example:
int hash(void * key) {
//...
}
int main (int ...
|
|
I have 2 doubles x and y. When I divide x/y I dont get the result I am hoping to get.
Here is the printf command I am using in c and ... |
|
Hi, I have a class Data as following class Data{ .... }; I know if I want to cast it to int implicitly I should write like following: class Data{ .... public: operator int() {...}; }; So, I can use the class like, Data d(1234); int a = d; However, what I really want is that user of class Data have ... |
Ark Khasin MISRA came up with those "underlying types" of sub-int size (like likely char and perhaps short) and the whole arithmetic on them. Basically, I need to continually cast back to the "underlying" type "as if" the computations were done on them without promotion. E.g., uint16_t a, b; a = (uint16_t)(~b); //RH would not approve of it instead of a ... |
Hi every c++ expert, today i've seen a strange case when i was debugging. When I cast a double to an int, the value is altered but it doesn't look like neither round up nor round down. Here is the code: double temp = (double )(pQinQplOdds[iOddsCount-1]*100); //temp = 820.00000 int odds = static_cast(temp); odds should get 820 but it doesn't. It ... |
|
|
I am trying to debug a confusing bit of stuff in a parallelized code. One possibility for a source of error is that the person who wrote it is using long ints for array indices, then for some reason casts it to an int for a function call, in which it is again used as an array index. Printing it showed ... |
#include main() { double a, b, c; a = 1.674; b = 1.322; printf("\n%4.2f",a); printf("\n%4.2f",b); a = a * 100; b = b * 100; printf("\n----"); //round the values in the variables a and b to the nearest hundredth a = (int) a; b = (int) b; //add the variables a and b c = a + b; c = c ... |
|
|
casting the system exstracted date into seperate ints Hey guys im writing a function to exstract the user date and then ask user input for there bithday to calculate there age. I have tokenized the current date but how would i put those 3 strings into 3 ints by casting. My casting does not work.. for example user enters 12/12/1984 the ... |
I have a problem casting a value to unsigned int. First problem, i have a function that returns unsigned int. If i return a plain integer like -3 it should make it sth positive? Well,it doesn't. Moreover, i have a big negative number and i cannot tranform it to unsigned int. I try sth like unsigned int result=(unsigned int) stomevalue but ... |
|
#include #include struct node { char make; char model; int year; char color; char plate; struct node* next; }; void menu(); void insert(struct node** head, char make, char , int, char, char); int main(void){ struct node* head = NULL; char make, model,plate,sfname,fname,color; int x,year; menu(); scanf("%d",&x); switch(x){ case 1: printf("Enter make: "); scanf("%s",&make); printf("Enter model: "); scanf("%s",&model); printf("Enter year: "); ... |