Thread: Random Q&A 2
View Single Post
Old Sep 25th, 2006, 6:27 AM   #11
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Can I do it in C# instead? It's basically the same thing. :p

using System;

class MyApp
{
	public static void Main (string [] args)
	{
		string Name;
		string [] Names;
		string FavouriteSubject, LeastFavouriteSubject;
		
		Console.Write("What's your name? ");
		Name = Console.ReadLine();
		Names = Name.Split(' ');
		
		Console.Write("What's your favourite subject? ");
		FavouriteSubject = Console.ReadLine();
		
		Console.Write("What's your least favourite subject? ");
		LeastFavouriteSubject = Console.ReadLine();
		
		Console.WriteLine("");
		Console.WriteLine("OK, your first name is " + Names[0] + ", your last name is " + Names[Names.Length - 1] + ", your favourite subject is " + FavouriteSubject + " and your least favourite subject is " + LeastFavouriteSubject + ". Have a nice day.";
	}
}

I have no idea why I did that, but I enjoyed it. Haven't tested it though, and I wrote it in a text editor so Autocomplete hasn't either.

How many points do you have on Project Euler?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote