// This is not real code, this is just // to show you what the computer sees. printf("What coin side came up? "); scanf(" %c", &coin); // type in 't' was_last_coin_heads = FALSE; // coin_count = coin_count + 1; coin_count += 1; // back to the top of the while loop // ------------------------------- printf("What coin side came up? "); scanf(" %c", &coin); // type in 'h' was_last_coin_heads = FALSE; if (coin == HEADS) { heads_count += 1; was_last_coin_heads = TRUE; } // coin_count = coin_count + 1; coin_count += 1; // back to the top of the while loop // ------------------------------- printf("What coin side came up? "); scanf(" %c", &coin); // 'h' // if the last coin was heads, and this // coin is also a heads, then print out a message! if (was_last_coin_heads == TRUE && coin == HEADS) { printf("Two heads in a row -- very lucky!\n"); } was_last_coin_heads = FALSE; // Tom stopped walking through here -- try and // continue on your own... if (coin == HEADS) { heads_count += 1; was_last_coin_heads = TRUE; } // coin_count = coin_count + 1; coin_count += 1; printf("What coin side came up? "); scanf(" %c", &coin); if (coin != HEADS && coin != TAILS) { printf("Wait! That's not heads or tails!\n"); // by default, if we don't know what the // flip is, let's make it a tails coin = TAILS; } // if the last coin was heads, and this // coin is also a heads, then print out a message! if (was_last_coin_heads == TRUE && coin == HEADS) { printf("Two heads in a row -- very lucky!\n"); } was_last_coin_heads = FALSE; if (coin == HEADS) { heads_count += 1; was_last_coin_heads = TRUE; } // coin_count = coin_count + 1; coin_count += 1; printf("What coin side came up? "); scanf(" %c", &coin); if (coin != HEADS && coin != TAILS) { printf("Wait! That's not heads or tails!\n"); // by default, if we don't know what the // flip is, let's make it a tails coin = TAILS; } // if the last coin was heads, and this // coin is also a heads, then print out a message! if (was_last_coin_heads == TRUE && coin == HEADS) { printf("Two heads in a row -- very lucky!\n"); } was_last_coin_heads = FALSE; if (coin == HEADS) { heads_count += 1; was_last_coin_heads = TRUE; } // coin_count = coin_count + 1; coin_count += 1; printf("What coin side came up? "); scanf(" %c", &coin); if (coin != HEADS && coin != TAILS) { printf("Wait! That's not heads or tails!\n"); // by default, if we don't know what the // flip is, let's make it a tails coin = TAILS; } // if the last coin was heads, and this // coin is also a heads, then print out a message! if (was_last_coin_heads == TRUE && coin == HEADS) { printf("Two heads in a row -- very lucky!\n"); } was_last_coin_heads = FALSE; if (coin == HEADS) { heads_count += 1; was_last_coin_heads = TRUE; } // coin_count = coin_count + 1; coin_count += 1; printf("What coin side came up? "); scanf(" %c", &coin); if (coin != HEADS && coin != TAILS) { printf("Wait! That's not heads or tails!\n"); // by default, if we don't know what the // flip is, let's make it a tails coin = TAILS; } // if the last coin was heads, and this // coin is also a heads, then print out a message! if (was_last_coin_heads == TRUE && coin == HEADS) { printf("Two heads in a row -- very lucky!\n"); } was_last_coin_heads = FALSE; if (coin == HEADS) { heads_count += 1; was_last_coin_heads = TRUE; } // coin_count = coin_count + 1; coin_count += 1;