Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Error with input, very basic. Words vs numbers.

$
0
0
Hi, im brand new to C#, as of today actually. Im learning it in a class and im struggling. I will post my code but i need to know how to make it so it accepts word input not just number input. As of now the program only responds to the questions i have in there if i put numbers in. Please help, thank you.

static void Main()
    {
        //Declare Variables
        double name, course, age, value;
        //This program will....
        Console.WriteLine("This program will....");
        //Have user put enter their full name.
        Console.WriteLine("What is your full name?");
        name = double.Parse(Console.ReadLine());
        //Have user put enter their course and section.
        Console.WriteLine("What is your course and section?");
        course = double.Parse(Console.ReadLine());
        //Have user put enter their age.
        Console.WriteLine("What is your age?");
        age = double.Parse(Console.ReadLine());
        //Have user put enter how much money they have.
        Console.WriteLine("How much money do you have?");
        value = double.Parse(Console.ReadLine());
        //Display all the information
        Console.WriteLine("Thank you {0}", name);
        Console.WriteLine("In {0}", course);
        Console.WriteLine("Your age is {0}", age);
        Console.WriteLine("And you have {0:C}", value);" 


Also i DO have the ConsoleReadLine(); at the bottom, forgot to put that in.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>