Search:

Type: Posts; User: crazychile

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Thanks. That FAQ actually helped!

    Thanks. That FAQ actually helped!
  2. write a program that returns the file type

    I need to write a short program in C where the file type is displayed when executed. Fot example ./a.out test.doc would print "the file is in .doc format".

    I'm pretty sure I need to use arg[c] and...
  3. Yeah, I'm liking that. Thanks!

    Yeah, I'm liking that. Thanks!
  4. That structure makes sense. Thank you. So I...

    That structure makes sense. Thank you.

    So I would still be checking the character by its ASCII value to determine a capital letter, or is there an easier way?


    thanks,
    crazychile
  5. How to take a char string and separate it at a capital letter?

    I need to write a program where a name is to be entered as a continuous string, such as "JohnDoe" and then it prints out "John Doe". The stipulation is that the first name becomes its own string and...
  6. I think I get ya now. I was stuck on finding the...

    I think I get ya now. I was stuck on finding the nearest integer that was a perfect square, instead of taking the square root and going up or down one from there and then squaring it.

    Thanks.
  7. Thanks. I should have asked that differently....

    Thanks.

    I should have asked that differently. How would you find the next lowest perfect square and the next highest?. I think I can manage the compare once I get those.

    thank you,
    crazychile
  8. Find the nearest integer that has a whole number square root

    I need to write a program that will ask for a number, and then print out the nearest integer that has a whole number square root. Its supposed to be able to handle numbers up to 10 digits.

    So if I...
  9. Thank you so much! It wont switch players now,...

    Thank you so much!

    It wont switch players now, but at least I'm getting somewhere. I commented out the gameAgain(1) for now.



    Welcome to the game of Pig. Would you like to view the rules? (y...
  10. Ok this is weird...youre right. I get the...

    Ok this is weird...youre right. I get the following output:



    Welcome to the game of Pig. Would you like to view the rules? (y or n)?
    n
    Player 1:
    Die 1 is a 5.
    Die 2 is a 5.
    Player 1, you...
  11. I'm not sure I understand. All of the code was...

    I'm not sure I understand. All of the code was included with the post.

    Why do I need time.h? Is that for the randomness of the dice?

    Thank you,
    crazychile
  12. ok thats a good hint tabstop. I hadn't thought...

    ok thats a good hint tabstop. I hadn't thought of that. I can see why it would do that if you answered n/n but why does it do that for y/y? Can you give me any hints how to fix this to make it do...
  13. I'm so close to finishing this...please help with logic error

    Here is my latest code:



    #include <stdio.h> // for interactive input and output
    #include <stdlib.h> // for the rand() function
    #include <ctype.h> // for tolower() macro
    #define SIDES 6...
  14. Thanks Elysia, the flow does make sense. ...

    Thanks Elysia, the flow does make sense.


    Here is the current code: (yes, I know the spacing is messed up)



    #include <stdio.h> // for interactive input and output
    #include <stdlib.h> //...
  15. Points are awarded per the roll combination....

    Points are awarded per the roll combination. There are combinations where no points are awarded and the roll automatically goes to the other player. In cases where the roll yields a scoring...
  16. Thank you. The way I currently have it written...

    Thank you.

    The way I currently have it written the green stuff actually was inside that loop for the turn.

    I have revised my chart a bit. I'm not really sure about the 3rd loop. I think I am...
  17. Wouldn't that be the condition in which the loop...

    Wouldn't that be the condition in which the loop would need to be executed?

    As to the others, I don't understand how to simplify the conditions any more.

    I'm completely open to suggestions.......
  18. How does the logic look for this - BEGIN...

    How does the logic look for this -



    BEGIN MAIN
    declare variables
    give option to view rules

    if the game is not over or we are playing again
    BEGIN LOOP1
  19. Thank you Elysia. I'm going to scratch out...

    Thank you Elysia. I'm going to scratch out another version now. I get messed up with how to start and close loops. What is the rule for DO? I want it to do the main from the rules onward but I also...
  20. for the main it looks like this: { ...

    for the main it looks like this:



    {
    variable declarations

    give option to print rules

    do
  21. Thank you. That is the general idea of what I'm...

    Thank you. That is the general idea of what I'm trying to do. But when I put the while loop at that location it wont compile.

    pig_v6.c:209: error: parse error before '}' token
    pig_v6.c:251:...
  22. ok the ; is a bad habit. I've done it in the past...

    ok the ; is a bad habit. I've done it in the past so that the file compiles. I'm starting to learn that if it doesnt compile that it might mean that something else needs to be fixed first.

    I don't...
  23. After trying some combinations... I'm guessing...

    After trying some combinations...

    I'm guessing where you're going with this is I need to do an if else. But then how do I make it go back to the top of the loop for a y answer?

    thanks,...
  24. Either my loop is bad or my function is messed up

    In my program I call this function:


    int turnAgain(int status)
    // function: turnAgain
    // pre: Player must have rolled a non disqualifying point combination
    // post: returns a valid (y or n)...
  25. Replies
    4
    Views
    892

    I'm a noob also so take this with caution... ...

    I'm a noob also so take this with caution...

    Do you really want the function declared as void? I would think if you're changing the settings as you are you would want it to return something.
    ...
Results 1 to 25 of 44
Page 1 of 2 1 2