D Programming – Input

Good Day, I was to talking to little kid this morning and he was asking me what color is the best. Every time I said a color he always answered “Really? (color)?”
What’s your favorite color? Yellow
Really? Yello?

haha, his expression made his annoying answer funny.

I adapated that kid to my program here showing basic input of string in D language.

Here is my annoying kid asking for colors program:

import std.stdio;
import std.string;

int main(){
	string input = "";
	
	write("What is your favorite color? ");
	input = strip(stdin.readln());
	
	writeln("Really? ", input, "?");
	return 0;
}

Here is the output:

d-input

 

I hope you like this post. Don’t forget to leave a comment.

Thank you very much.