So I'm really close. Here's my updated code. I've got the back and forth in there but it's not working quite right. The player 1 button-press doesn't work but the player 2 button-press is working...
Type: Posts; User: PhantomJoe
So I'm really close. Here's my updated code. I've got the back and forth in there but it's not working quite right. The player 1 button-press doesn't work but the player 2 button-press is working...
Met again with my teacher tonight and while I wasn't a whole lot wrong in terms of needing to rewrite tons of code I did have a fundamental error in the while condition. It should have been joined...
I see that I had return 0 in the wrong place so thank you for that. I've moved it and made a few other changes like changing the condition for the while loop and adding a check for score total right...
Thank you for the tip. I barely know what I'm doing but I will certainly try to remember this point.
I've added some comments to your reply to address each of your points to help me organize my thoughts.
Also, the chars toPlay1 and toPlay2 were added thinking I would need 2 variables for each player for the button press piece of the code. I.e. - "Player press 'a' to roll your dice or press 'q' to...
Again, thank you for the tip. I've incorporated the use of total as a variable in place of the 2 variables I had been using. I've also corrected the issue where Player 1's score was never printing...
This was helpful, it helped me see that the issue with the Player 2 code being left outside the loop and that was an easy fix so thank you.
Here's what it looks like now.
int main()
{...
The loop condition in the while statement, doesn't that need each argument to be separated with an "OR" or did I misunderstand?
while (quit != 'q' || My_result < 50 || Your_result < 50)
So...
So here is my new code. The good news is it does compile but the bad news is it appears to be an infinite loop that never gets past the player 1 portion of the code.
The goal is to have each...
Yes, we haven't learned about switch. I did meet with my teacher tonight and got a good deal of help. I'll post my new code tomorrow and hopefully get some feedback here.
First off thank you for the tip on printf, that looks much cleaner.
Secondly, for the inner while loops you recommended, do I need to have an additional variable that identifies user 1 and user...
I'm working to write a program that will allow 2 players to play the dice game called "Fifty".
I apologize if this has been covered in another post but I did spend the last hour looking through...
Can you explain with this printf statement is doing? printf("%*c",space,'*');
I understand that the %c is identifying the data type that will be printed but I'm not sure I understand what the...
Hi Salem. So I think I figured out the right code to get your above output:
int main()
{
int row;
int col;
int numspaces;
for (row = 4; row >= 0; row--)
I know I need to incorporate the logic you laid out to get the correct number of asterisks (row*2-1) but because I'm unsure of how to implement that I've just been trying to insert it in different...
Lol, so I've tried all kinds of changes to the for loop for columns but I either wind up printing a single asterisk or I create an infinite loop with infinity asterisks.
In the first row I need 3 leading spaces, in the second row I need 2 leading spaces, and in the third row I need 1 leading space (and no leading spaces for the 4th row). I'll be honest, I'm really...
Mathematically I understand your logic. 2*rows -1 will give me the correct number of asterisks per row (2*1-1=1 and 2*2-1=3 and so on) but how do I account for the leading blank spaces?
I think I also neglected to mention that I am also struggling to find the right code that will also give me the correct number of asterisks per row.
Hi everybody. I'm in my first programming course ever and have a few questions about an assignment that we've been given.
I'm trying to print the following pattern to the screen:
15235
The...
This was exactly what I was overlooking. When I replace all the assignment operators with comparison operators the program returns just the one line that corresponds to the entry from the end user. ...
Hi all,
I'm new to programming and so naturally am new to the C programming language. I'm taking a college course (Intro to C Programming) and am working through my first assignment. I thought I...