7
Reply

Twitter help ! :P

Prime b

Prime b

Dec 29 2011 7:02 PM
2.7k
This is what I have to do
Write a console-based program that accepts a user's
message and determines whether it is short enough for
a social networking service that does not accept messages
of more than 140 characters. Save the program as
Twitter.cs.

This is what i have done

  double maxLimit = 140;
  double userInPut;
  string stringUserInPut;

  Console.WriteLine("Enter your message, but remember the text cannot exceed 140 characters");
  stringUserInPut = Console.ReadLine();
  userInPut = Convert.ToDouble(stringUserInPut);

  if (userInPut > maxLimit)
  Console.WriteLine(" The message is too long , sorry");
  else
  Console.WriteLine(" Your message is sent");

My questions are, how can I allow any characters to be typed in,such as numbers, symbols , etc, with double I can only do numbers and if I do letters it gives a me an error. also in the problem they ask me to " not accept the message if its over 140 characters" when in my version it shows message.

Answers (7)