Search:

Type: Posts; User: tzuchan

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    8
    Views
    1,318

    post the part of the code where you are having...

    post the part of the code where you are having trouble.
    I think using fgets and sscanf should be able to get most of the data into the appropriate places. using strtok and having a special character...
  2. Replies
    7
    Views
    12,724

    ah, the good old returning pointers stuff......

    ah, the good old returning pointers stuff...
    first of, refrain from returning pointers... BAD move, cause if you are returning a pointer to an inside variable, the data will be gone before you can...
  3. Replies
    13
    Views
    6,227

    if that's the case, write a program that does...

    if that's the case, write a program that does this:
    if(temp == EOF)
    printf("%c", temp);

    and then start hitting that keyboard of yours with as many ctrl combinations until you hit the EOF...
    ...
  4. Replies
    7
    Views
    12,724

    char *string_replace (char *s, char c, char r) {...

    char *string_replace (char *s, char c, char r) {

    char *p1;

    for (p1=s; *p1; p1++) {
    if (*p1 == 'c'){ // <---- Error here
    *p1 == 'r';} // <---- And here...
    ...
  5. Replies
    12
    Views
    1,853

    Okay. Didn't bother coding it into a compiler and...

    Okay. Didn't bother coding it into a compiler and seeing what's going on, but basically, I think it returns the number of first n characters in string s that exist in string t.
    first of all, passing...
  6. Replies
    5
    Views
    1,121

    actually, no. the if(n) is acutally checking to...

    actually, no.
    the if(n) is acutally checking to see whether your n is pointing to a NULL or not.
    if it is pointing to a NULL (which is commonly defined as 0), the if statment becomes false and...
  7. Thread: Skipping

    by tzuchan
    Replies
    25
    Views
    2,897

    try adding this line beneath every occurance of...

    try adding this line beneath every occurance of scanf
    while((temp = getchar) != EOF && temp != '\n'); // <--- must have semicolon
    This should clean out the input buffer.
  8. Err... I'm not too sure that's possible?...

    Err... I'm not too sure that's possible?
    Normally, when we play with characters in console, we are using the ascii character set...
    now, without the windows.h header file, I'm not aware of any way...
  9. Replies
    10
    Views
    4,996

    assuming you are directly cut and paste, here's...

    assuming you are directly cut and paste, here's an error
    if((ques !='y)' || (ques !='Y'))
    also, ques != 'y' || ques != 'Y' will give you true no matter what you enter...
    if ques == 'y', then ques...
  10. Replies
    14
    Views
    3,888

    ...That's not not having to include all the...

    ...That's not not having to include all the header files you use, that's just putting it in another file...

    And as to the one to one ratio of header and source files, that honestly up to personal...
  11. Replies
    16
    Views
    5,867

    umm... with regards to your mention of what...

    umm... with regards to your mention of what size_t is, it's actually a unsigned long int or unsigned int, depending on your compiler IIRC...

    Also, a bit of clarification regarding the .c and .cpp...
  12. first off, ? exists in C, second off, changing...

    first off, ? exists in C, second off, changing that still doesn't make that macro make sense...

    Essentially, macros are a shortcut for replacing certain types of things in the code when you...
  13. Replies
    2
    Views
    1,280

    /shrugs Actually, that depends on what he's...

    /shrugs
    Actually, that depends on what he's trying to do...
    if he's doing the == comparison, then it's risky, very much so...
    but if he uses the fabs() function with it, such types of comparisons...
  14. Replies
    14
    Views
    3,888

    Okay, I'm not going to go through this file by...

    Okay, I'm not going to go through this file by file because apparently the major problem is that you don't quite know how to include separate files yet...

    First major problem:

    The file that...
  15. Replies
    14
    Views
    3,888

    Hmm... Don't have much experience with console...

    Hmm... Don't have much experience with console based compilers, and can't look through your source codes to see if there's any errors...

    could you post the #include part of all your header files...
  16. Replies
    14
    Views
    3,888

    First of all, check and make sure that your...

    First of all, check and make sure that your function files include thier respective header at the top.
    Eg: header file name == myfuncs.h
    in file containing the code of the functions, at the top,...
  17. Replies
    14
    Views
    2,394

    Essentially, when you loop and run the scanf to...

    Essentially, when you loop and run the scanf to num, you clear out anything that was originally stored in the num variable... that includes the sum of previous data(not that it actually sums it...
  18. Replies
    52
    Views
    6,585

    I spotted some thing that doesn't seem right... ...

    I spotted some thing that doesn't seem right...



    int usedcharacters (char usedchars [], char let2bg)
    {
    int k;
    for(k = 0; usedchars[k] != '\0' && usedchars[k] != let2bg; k++);
    ...
  19. Replies
    52
    Views
    6,585

    The good news is, you almost got it working. The...

    The good news is, you almost got it working.
    The bad news?
    You didn't store the char value that the function return.
    In order to store a value that a function returns using the return, you have...
  20. Replies
    52
    Views
    6,585

    As long as you pass in the usedchars array from...

    As long as you pass in the usedchars array from the main function and you initialize it as
    usedchars[maxnumofguess+1] = "";
    the usedchars array will become your store of which characters have been...
  21. Replies
    7
    Views
    9,629

    least complex but more coding way? create...

    least complex but more coding way?
    create another function similar to your minimum function, but return the index of the minimum value instead.

    Any other method would atleast require pointers if...
  22. Replies
    52
    Views
    6,585

    if (let2bg = usedchars[k]) That should have been...

    if (let2bg = usedchars[k])
    That should have been
    if (let2bg == usedchars[k])
    it's one of the easier to make programming errors...
    Also, you can try initializing the array with '*'s or ' 's so...
  23. Replies
    2
    Views
    1,052

    if(fwrite(&people[n], sizeof(CONTACT), n, fp)!=1)...

    if(fwrite(&people[n], sizeof(CONTACT), n, fp)!=1)


    The error is in this line.
    first of all, a bit of explanation about the fwrite function.
    First of all, let me state that fwrite is IMHO...
  24. Thread: type swapping?

    by tzuchan
    Replies
    11
    Views
    1,527

    actually that was a program to test and see if I...

    actually that was a program to test and see if I can make the program automatically treat the union as one of the members without having to specifically calling the member.

    essentially, what I was...
  25. Replies
    52
    Views
    6,585

    in the order of your questions starting from do...

    in the order of your questions starting from do you need a for loop
    yes, it's good programming practise to do so, *shrugs* could be anything, depending on how you want to use it, you should stop...
Results 1 to 25 of 53
Page 1 of 3 1 2 3