| Thread overview |
|---|
February 14, 2015 Your 02.14 | ||||
|---|---|---|---|---|
| ||||
2015-2-14,I build a small program for wife:
module for214;
import std.stdio;
import std.random;
extern(C) int setlocale(int, char*);
static this()
{
import core.stdc.wchar_;
fwide(core.stdc.stdio.stdout, 1);
setlocale(0, cast(char*)"china");
}
void main()
{
int i;
while (1)
{
int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8,9];
if(i ==0)
{
foreach(p;a)
write(p,",");
writeln("\n共有10个奖,从现在开始闭上眼睛,过10秒钟,然后随意输个数,开始抽奖:");
}
else
{
break;//若删除,可以连续中3次。
}
char[] b;
readln(b);
if(b[0] =='q') break;
string[] s =["祝节日快乐","中奖300元","老公洗你的衣服","一起看电影(任你选)","一起吃大餐","明天下午老公带孩","老公给你讲笑话","网上看大片,老公带孩","在一起","给孩讲故事"];
foreach (e; randomCover(a))
{
writeln("中的是:",s[e]);
if(e != 0)
break;
else
{
writeln("不满意? 再来一次:");
continue;
}
}
i++;
if(i >2)
{
writeln("恭喜老婆!");
break;
}
}
}
-------------------------end-----------------
How about you?
| ||||
February 14, 2015 Re: Your 02.14 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to FrankLike | On Saturday, 14 February 2015 at 14:39:34 UTC, FrankLike wrote:
> 2015-2-14,I build a small program for wife:
>
> module for214;
>
> import std.stdio;
> import std.random;
>
> extern(C) int setlocale(int, char*);
>
> static this()
> {
> import core.stdc.wchar_;
> fwide(core.stdc.stdio.stdout, 1);
> setlocale(0, cast(char*)"china");
> }
>
>
> void main()
> {
> int i;
> while (1)
> {
>
> int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8,9];
> if(i ==0)
> {
> foreach(p;a)
> write(p,",");
>
> writeln("\n共有10个奖,从现在开始闭上眼睛,过10秒钟,然后随意输个数,开始抽奖:");
> }
> else
> {
> break;//若删除,可以连续中3次。
> }
> char[] b;
> readln(b);
>
> if(b[0] =='q') break;
>
> string[] s =["祝节日快乐","中奖300元","老公洗你的衣服","一起看电影(任你选)","一起吃大餐","明天下午老公带孩","老公给你讲笑话","网上看大片,老公带孩","在一起","给孩讲故事"];
>
> foreach (e; randomCover(a))
> {
> writeln("中的是:",s[e]);
> if(e != 0)
> break;
> else
> {
> writeln("不满意? 再来一次:");
> continue;
> }
> }
> i++;
> if(i >2)
> {
> writeln("恭喜老婆!");
> break;
> }
> }
> }
>
> -------------------------end-----------------
> How about you?
i'm not doing valentines day but i did propose my wife with a d program i wrote. :-)
| |||
February 14, 2015 Re: Your 02.14 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to FrankLike Attachments: | i made a present for myself (as i really really love myself very much): a minimalistic LISP interpreter (yeah, i need a *small* scripting language, and memory/speed doesn't matter in this case, only source code size). and i titled it MILF. | |||
February 15, 2015 Re: Your 02.14 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to ketmar | On 2015-02-14 at 21:41, ketmar wrote:
> i made a present for myself (as i really really love myself very much): a
> minimalistic LISP interpreter (yeah, i need a *small* scripting language,
> and memory/speed doesn't matter in this case, only source code size). and
> i titled it MILF.
MILF as in Minimalistic Interpreter of Lisp Forms
or Minimalistic Instant Lisp Fix? ;)
| |||
February 15, 2015 Re: Your 02.14 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to FG Attachments: | On Sun, 15 Feb 2015 01:06:36 +0100, FG wrote:
> On 2015-02-14 at 21:41, ketmar wrote:
>> i made a present for myself (as i really really love myself very much):
>> a minimalistic LISP interpreter (yeah, i need a *small* scripting
>> language,
>> and memory/speed doesn't matter in this case, only source code size).
>> and i titled it MILF.
>
> MILF as in Minimalistic Interpreter of Lisp Forms or Minimalistic Instant Lisp Fix? ;)
actually, it's "May I Leave Free?", as i really bored to recompile project on each little customer fix (and 'cause my English sux). or "My Incredible Language Foundation" when i need to describe to customers what all that brackets means. ah, i don't know. ;-)
| |||
March 19, 2015 Re: Your 02.14 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to ketmar | The range version of startsWith (which I suspect is the most commonly used one) is optimized beautifully. This leaves the (rather trivial) single element one and the "one haystack, any of these needles" one. _______________ ahsan | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply