www.digitalmars.com         C & C++   DMDScript  

D - scanf and then using result in case, not working in D

With scanf you can't use the scanf result in D case !?!?!?


import std.c.stdio;

char[80] name;

printf("Yo! What's your name? ");
scanf("%s", &name);
printf("\nHey, %.*s, ", name);

// Give name, example John -> Never go in right Case (always Default!!!)

switch(name)
{
case "John":
printf("JOHN IS THE NAME!\n");
break;
case "Bill":
printf("BILL IS THE NAME!\n");
break;
case "Cindy":
printf("CINDY IS THE NAME!\n");
break;
default:
printf("Nobody\n");
}	
Jan 09 2004