Search:

Type: Posts; User: Mohsen Abasi

Search: Search took 0.01 seconds.

  1. why big numbers change in floating-point variables?

    hi i don't know why but some of the values change on their own when i run this code. why?

    #include <stdio.h>
    #include <math.h>

    int main(void)
    {
    double a = 111 * pow(10,20);
    double b...
  2. a question about signed and unsigned variables

    for example both short and unsigend short take 2 bytes of memory and from 0 to 65535 or from -32768 to 32767. so if both types take up 2 bytes of memory, how does the computer realize one is signed...
  3. Replies
    1
    Views
    1,929

    maximum value of long double _Complex

    hi i want to know what is the maximum value of data type long double _Complex.
    for integer data types we use limits.h and for floating-point float.h. but what about _Imaginary and _Complex where can...
  4. what is the precision and max value of double and long double?

    hi as the title of the thread says i don't know how to get the precision and max value of double and long double. if I'm not mistaken (this is from a long time ago) by including the limits.h you can...
  5. Replies
    2
    Views
    6,938

    how do i read two bytes in a row?

    hi first look at this code:

    #include <stdio.h>
    #include <stdlib.h>

    void binary(char byte) {
    unsigned char mask = 0x80;
    for ( ; mask; mask >>= 1)
    putchar(byte & mask ? '1'...
  6. Replies
    4
    Views
    3,892

    why doesn't this work?

    hi i don't know why but this code produces no output. I'm a beginner i don't get. why doesn't this work?


    #include <stdio.h>

    int main()
    {
    char c[] = "0110";
    if (c == "0110")
    ...
  7. Replies
    2
    Views
    4,738

    how do i split a string into two?

    i need to know how can i split a string of characters into two.
    i have one str[8] array and want two str1[4] and str2[4] arrays with str1 having the first half of str and str2 the rest.
    how can i...
  8. I've read the book teach yourself c in 21 days...

    I've read the book teach yourself c in 21 days from sams publishing and it didn't cover what you just did in the binary function. can someone explain to me what he did? also i need a book...
  9. how can i manipulate a file in binary mode?

    hi take a look at this source code (it doesn't have bugs):


    #include <stdio.h>
    #include <stdlib.h>

    int main( void )
    {
    FILE *fp;
    int c;
  10. thanx i get it now. i'll get to writing it...

    thanx i get it now. i'll get to writing it immediately
  11. how can i seek in a file in binary mode?

    my problem is after i open a file in "rb" mode i want to start from beginning and read one byte at a time assign the current byte to a variable so i can perform operations on it and then save the...
  12. strcpy crashes program when used with a char pointer.

    the title says it all.
    here's an example code i tested too:


    #include <stdio.h>
    #include <string.h>

    char * str;

    int main( void )
  13. Replies
    6
    Views
    2,388

    i changed else if (state = OUT) to else if...

    i changed

    else if (state = OUT)
    to

    else if (state == OUT)
    and it now it works thanks for the help and your suggestions
  14. Replies
    6
    Views
    2,388

    the code from my book doesn't work!!

    hi I'm reading a book called the c programming language second edition by dennis ritchie and one of the source codes in section 1.5.4 doesn't work properly.

    here's the code:

    #include <stdio.h>...
  15. Replies
    1
    Views
    3,198

    i need a Cpp cookbook

    hi I'm in desperate need of a book about c++ that introduces problems and solutions but i could only find books in this genre in python and some other languages. does anybody know a good book about...
  16. how do i make the condition statement in my for loop a variable?

    hi the code I'm talking about is this :

    #include <iostream>
    int main()
    {
    using namespace std;
    char h[] = "Hello"

    for (int i = 0; i = 5; i++)
    cout << h[i];
  17. Replies
    5
    Views
    1,713

    i fixed this with this code: #include...

    i fixed this with this code:

    #include <stdio.h>

    int main(void)
    {
    float pint, cup, ounce, tablespoon, teaspoon;
    printf("How many cups? ");
    scanf("%f", &cup);
    pint = cup / 2;
  18. Replies
    5
    Views
    1,713

    getting incorrect output

    hi i'm doing an exercise from C Primer Plus. the problem is this:


    this is the code i wrote:

    #include <stdio.h>

    int main(void)
    {
    float pint, cup, ounce, tablespoon, teaspoon;
Results 1 to 18 of 18