Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 668601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:03:31+00:00 2026-05-14T00:03:31+00:00

I have the following code: The actual problem is the non-quoted code. I want

  • 0

I have the following code:
The actual problem is the “non-quoted” code.
I want to get the player amount (max = 4), but when I ask via Console.Read() and I enter any Int from 1 to 4 I get as value: 48 + Console.Read().
They only thing how I can get the “real” input is using Console.ReadLine(), but this does not give me an Integer, no it returns a string, and actually do not know how to convert String (Numbers) to Integers in C#, because I am new, and because I only found ToString() and not ToNumber.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace eve_calc_tool
{
    class Program
    {

        int players;
        int units;
        int active_units;
        int inactive_units;
        int finished_units;
        int lastDiceNumber = 0;
        bool game_state;

        public static void Main(string[] args)
        {
            int count_game = 0;

            //Console.Title = "Mensch ärger dich nicht";
            //Console.WriteLine("\tNeues Spiel wird");
            //Console.WriteLine("\t...geladen");
            //System.Threading.Thread.Sleep(5000);

            //Console.Clear();
            //Console.WriteLine("Neues Spiel wird gestartet, bitte haben sie etwas Geduld");
            //Console.Title = "Spiel " + count_game.ToString();

            //Console.Clear();
            //string prevText = "Anzahl der Spieler: ";

            //Console.WriteLine(prevText);

            string read = Console.ReadLine();

            /*Program game = new Program();
            game.players = read;

            game.setPlayers(game.players);

            if (game.players > 0 && 5 > game.players)
            {
                game.firstRound();
            }*/

            string readagain = read;




            Console.ReadLine();
        }
        /*
        bool setPlayers(int amount)
        {
            players = amount;

            if (players > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        bool createGame()
        {

            inactive_units = units = getPlayers() * 4;
            active_units = 0;
            finished_units = 0;

            game_state = true;

            if (game_state == true)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        int getPlayers()
        {
            return players;
        }


        private static readonly Random random = new Random();
        private static readonly object syncLock = new object();
        public static int RandomNumber(int min, int max)
        {
            lock (syncLock)
            { // synchronize
                return random.Next(min, max);
            }
        }


        int rollDice()
        {
            lastDiceNumber = RandomNumber(1,6);
            return lastDiceNumber;
        }

        int firstRound()
        {
            int[] results = new int[getPlayers()];

            for (int i = 0; i < getPlayers(); i++)
            {
                results[i] = rollDice();
            }
            Array.Sort(results);

            return results[3];
        }
         */
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:03:31+00:00Added an answer on May 14, 2026 at 12:03 am

    You can use

    int convertedNumber = int.parse(stringToConvert)
    

    or

    int convertedNumber;
    
    int.TryParse(stringToConvert, out covertedNumber)
    

    to convert strings to integers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 344k
  • Answers 344k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I agree that creating a wrapper that implements TextReader, delegates… May 14, 2026 at 5:41 am
  • Editorial Team
    Editorial Team added an answer My two cents . . . I'd be worried if… May 14, 2026 at 5:41 am
  • Editorial Team
    Editorial Team added an answer Main gotcha is to try to envisage C++ in terms… May 14, 2026 at 5:41 am

Related Questions

Using the adapter pattern, combined with IoC (specificly Unity), I would like to create
I need to translate the following Code to an Expression and I will explain
I have a MSHTML-based control embedded in an application and the ContentEditable mode is
EDIT See my solution below /EDIT I have a Visual Studio solution with two
A bit long, but, shorter than the first draft :) We have a small

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.