User Profile

Collapse

Profile Sidebar

Collapse
cube
cube
Last Activity: Mar 26 '08, 03:54 PM
Joined: Feb 16 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • cube
    replied to if else brackets problem
    in C
    The amount of code that I posted was a tiny piece of the assignment.
    Is there any way else to express the problem without posting the code?

    About my problem now, probably the if else isn't a good solution to my problem.
    Should I give it one more try or should I look for sth else?...
    See more | Go to post

    Leave a comment:


  • cube
    started a topic if else brackets problem
    in C

    if else brackets problem

    Code:
    for (i=0; i<8; i++)
     {
         if(score[i]==-2)
         {
             if(i<3)
             {
                for (j=0; j<3; j++)
                {
                    if (P[i][j]=='\0')
                    {
                       P[i][j]='O';
                       j=3;
                    }
                }
                else if (i<3 && i<6)[B]I get a message here: "expected[/]
    ...
    See more | Go to post
    Last edited by Ganon11; Mar 10 '08, 03:21 PM. Reason: Trimmed code

  • cube
    replied to functions arrays and pointers problem
    in C
    Finally there is a more simple way to do this without pointers.

    But just to enrich my knowledge I would like to find how to do it both ways.
    See more | Go to post

    Leave a comment:


  • cube
    replied to functions arrays and pointers problem
    in C
    Please note that I wasn't the one that "Pleased for help" but Xrysa.

    Thank you for pointing it out for me. I did try to read about pointers and arrays before post this code but I couldn't understand much, about the particular assignment.
    Can I find the answer to my question in the article "Arrays Revealed"?...
    See more | Go to post

    Leave a comment:


  • cube
    replied to functions arrays and pointers problem
    in C
    Sorry, I post this code late after midnight and I did look for it but I didn't remember which symbol to click. Now I know!!!...
    See more | Go to post

    Leave a comment:


  • cube
    started a topic functions arrays and pointers problem
    in C

    functions arrays and pointers problem

    I want to print the results of the best schedule array (which is shorted in a specific way in the find_best_scedu le function) through the main program. Actually I should print the results by using a second function named print_best_sche dule, but this seems too complicated and I prefer to do one step at a time.

    The problem is that I don't know how to print the array through the pointer "ptr".

    Here is the code...
    See more | Go to post
    Last edited by Banfa; Mar 5 '08, 09:22 PM. Reason: Code removed at users request, conformance to posting guidelines

  • cube
    replied to Arrays Revealed
    in C
    Yes, but after compilation, they don't return any results to the screen (propably because there are no printf). And at least for me who just started reading about C is difficult to place a printf on examples with pointers and arrays, etc.
    ...or am I doing sthg wrong and I don't get results??????...
    See more | Go to post

    Leave a comment:


  • cube
    replied to wrong estimations and confusion with arrays
    in C
    Finally...I made it!!!
    I don't know what went wrong at the first time and I got those strange results.

    Thanks guys (or girls). You were right about your conclusions.
    See more | Go to post

    Leave a comment:


  • cube
    replied to wrong estimations and confusion with arrays
    in C
    I've got your point. And it seems right.

    But when I write it this way
    if (best_time_done[i]==-1)
    if ((table[k][1]<min) && (best_time_done[k]==-1))

    I get crazy results:

    best time done:
    0 0 4007064 16 4007072 9264 3998072

    best time
    96 3997696 .......etc...
    See more | Go to post

    Leave a comment:


  • cube
    replied to wrong estimations and confusion with arrays
    in C
    Propably, I didn't explain it good enough.
    The "best_time_ done[]" is an array with all the values set to -1.
    Each value of this array represents a value from the array "best_time[]".
    For example.
    "best_time_ done[1]=-1" means that the first value of the array "best_time[]" isn't sorted
    "best_time_ done[2]=0" means that the second value of the array "best_time[]"...
    See more | Go to post

    Leave a comment:


  • cube
    started a topic wrong estimations and confusion with arrays
    in C

    wrong estimations and confusion with arrays

    I must sort the below values of table[][3] in a specific way.
    Everytime that I possition a sorted value to the best_time array, I marked it as a "job done" by giving the value 0 to the table best_time_done[7].
    Though I mark the "best_time_ done[2]=0" the program keeps estimating it as a value of -1 and not a 0.
    I debugged it and I saw that it is best_time_done[2]=0. But when it reaches the
    if (best_time_done[2]=-1)...
    See more | Go to post
    Last edited by sicarie; Feb 27 '08, 06:40 PM. Reason: Code tags are [code=c] and after your code [/code]. Please use them. They want to be used. They like to be used.

  • cube
    replied to problem with logical operators
    in C
    I'm sorry if I made you think that I'm looking for someone to solve my assignments, I didn't mean it.
    I'm a married working woman with a child (and mature enough to respect the "laws" of universities) and I really really luck of free time.
    I do my best and I want to learn as much as I can, though my whole schedual is too hard (to keep up with), I don't want to give up. I have worked to the bone with this one and I couldn't...
    See more | Go to post

    Leave a comment:


  • cube
    replied to problem with logical operators
    in C
    Hi again and thank you for your time!

    First of all I would like to mention that I am the newbiest newbie in C programming, (I start reading about C, just 2 weeks ago) though I'm trying hard to figure everything out. Now, about my problem...



    I did try to do that, but it didn't work out (due to my mistaken code...of course)...there fore I wrote the above code.
    Could I have a hint on how to do that?...
    See more | Go to post

    Leave a comment:


  • cube
    replied to problem with logical operators
    in C
    You are right about your thoughts!!!
    Actually, this is the way I did it for the first time.
    But, even if I tried it, your way (which is the right one) I still get wrong results.
    What it happens, is that the result should be result=2
    And that is what I get as I run the program, but unfortunatelly, it doesn't stop there.
    It goes on to:

    for (i=0; i<8; i++)
    {
    if ((move_main==9)...
    See more | Go to post

    Leave a comment:


  • cube
    started a topic problem with logical operators
    in C

    problem with logical operators

    Hallo everyone,
    I have written the below code but it doesn't work right.
    The problem is that when I run it, and

    the score_main array has a value of -3 or 3 and at the same time

    the move_main is 9, I get as a "result" the number 3, which is wrong

    according to this:

    [CODE=c] for (i=0; i<8; i++)
    {
    if ((move_main==9) && ((scor...
    See more | Go to post
    Last edited by Ganon11; Feb 25 '08, 07:09 PM. Reason: Please use the [CODE] tags provided.

  • cube
    replied to Arrays Revealed
    in C
    Very good article!

    If you could write some examples that we could copy and paste them to a compiler, just to see the result, it would be nice!
    See more | Go to post

    Leave a comment:


  • cube
    replied to How to pass 2D array to function
    in C
    My congratulations "weaknessforcat s".
    Functions are troubling me too and you made everything, more than crystal clear!
    See more | Go to post

    Leave a comment:


  • cube
    started a topic problem in functions
    in C

    problem in functions

    Hi, I'm a newbie and I have to make the following assignment.

    We are asked to use this function
    void get_input(char P[3][3], int *line, int *column);
    It is a part of a tic-tac-toe game and we have to use the above function
    in order to ask the player to give the coordinates of the cell. In that cell will be placed the letter "X".
    I have many problems.
    I have written the code and if I use...
    See more | Go to post
No activity results to display
Show More
Working...