Thanks. That FAQ actually helped!
Type: Posts; User: crazychile
Thanks. That FAQ actually helped!
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...
Yeah, I'm liking that. Thanks!
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
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...
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.
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
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...
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...
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...
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
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...
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...
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> //...
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...
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...
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.......
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
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...
for the main it looks like this:
{
variable declarations
give option to print rules
do
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:...
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...
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,...
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)...
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.
...