Prime b

Prime b

  • NA
  • 810
  • 340.4k

Word manipulation

Jan 5 2012 12:16 AM
Write a console-based program that asks a user for a business
name. Suggest a good Web address by adding "www."
to the front of the name, removing all spaces from the name,
and adding ".com" to the end of the name. For example,
a good Web address for "Acme Plumbing and Supply"
is www.AcmePlumbingandSupply.com


My question: why I can only type 1 character? If I type two letters than the program gives me an error... Also how can i remove spaces from the text user enters?

What I have done:


            string userInputString;
            char userInput;
            string www = "www";
            string com = ".com";

            Console.WriteLine("Please enter your business name");
            userInputString = Console.ReadLine();
            userInput = Convert.ToChar(userInputString);

            Console.WriteLine(www + userInput + com);

Answers (3)