Note that there are some explanatory texts on larger screens.

plurals
  1. POCode won't compile and i don't understand what these errors are for
    primarykey
    data
    text
    <p>so as the title says my code won't compile i get multiple issues now and before when it was formatted differently it worked to some extent. but now the code completly refuses to run and with my current level of understanding i am unable to figure out the issue but i believe the issue is just the way i've formatted the program so it follows the flowchart.</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication3 { class Program { static void Main(string[] args) { // SETUP SESSION // Declare variables Int32 currentGuess, upperLimit, randomNumber; double maxGuesses; char playAgain; Random random = new Random(); // WELCOME THE USER Console.WriteLine("Welcome to the high/low guessing game."); //INITILIZE WIN COUNT AND GAME COUNT Int32 gameCount = 0, winCount = 0; //DO LOOP #1 do //SETUP GAME { //REQUEST USER FOR UPPER LIMIT Console.WriteLine("Enter Upper range (e.g. 100):"); upperLimit = Int32.Parse(Console.ReadLine()); //INITILIZE GUESS COUNT Int32 guessCount = 0; bool gameOver = false; //DETERMINE RANDOM NUMBER randomNumber = random.Next(1, upperLimit); //DETERMINE MAX GUESSES maxGuesses = Math.Ceiling(Math.Log(upperLimit, 2) - 1); // INFORM USER RANDOM NUMBER IS CHOSEN AND INDICATE NUMBER OF GUESSES ALLOWED Console.WriteLine("I picked a number between 1 and {0} you get {1} chances to guess it", upperLimit, maxGuesses); //DO LOOP #2 do { //PLAY GAME //READ GUESSES Console.WriteLine(string.Format(" Enter Guess {0}: ", guessCount)); currentGuess = Int32.Parse(Console.ReadLine()); if (currentGuess == randomNumber) { //INCRIMENT WIN COUNT winCount++; } if (currentGuess == randomNumber) { Console.WriteLine("You got it!"); gameOver = true; gameCount++; } else if (currentGuess &gt; randomNumber) { Console.WriteLine("Too High"); } else if (currentGuess &lt; randomNumber) { Console.WriteLine("Too Low"); } } while (guessCount &lt; maxGuesses &amp;&amp; gameOver == false); //POST PROCESSING GAME if (guessCount++ == maxGuesses) { //INCRIMENT GAME COUNT gameCount++; Console.WriteLine("You lost"); //DISPLAY CORRECT NUMBER IF TOO MANY INCORRECT GUESSES Console.WriteLine("\nThe number was {0},better luck next time!", randomNumber); guessCount = 1; //PROMPT TO PLAY AGAIN Console.WriteLine("Would you like to play again? (Y/N)"); playAgain = char.Parse (Console.ReadLine()); } while (playAgain == 'y' ||playAgain == 'Y'); // display win count Console.WriteLine("Thanks for playing, you won {0} out of {1} games", winCount, gameCount); Console.ReadLine(); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload