I am having a problem with my code, still a newb sorry, but wondering what is the problem, it always shows up as 10 when the user should input name and number (it can be any number) and the output of it, the name is fine and the number is not, i know it has to do with ASCII however i dont know howto get around it, any ideas? here is the code below if you can just re-write it to correct it that would be great thanks
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int myinteger;
string mystring;
Console.WriteLine("please enter your first name");
mystring = Console.ReadLine();
Console.WriteLine("your name is " + mystring);
Console.Read();
Console.WriteLine("please enter a number");
myinteger = Convert.ToInt32(Console.Read());
Console.WriteLine("you have entered " + myinteger);
Console.WriteLine("your name is " + mystring + " and the number you picked is " + myinteger);
Console.Read();
}
}
}


Sign In
Create Account


Back to top









