Matlab 版 (精华区)

发信人: zjliu (秋天的萝卜), 信区: Matlab
标  题: 发布一个程序——作为新年贺礼吧
发信站: 哈工大紫丁香 (Fri Jan  2 16:15:09 2004), 站内信件

% 转载的时候注意版权,呵呵!
% 遇到问题可发信至: zjliu2001@163.com

% 注意把这段程序存为mortar.m文件
% 这个程序有着能够看穿你心思的特殊能力,试试吧!

close all
figure(1)
set(gcf,'Color','w');
set(gcf,'Position',[146 54 860 720]);

h_text1=uicontrol(gcf,'style','text',...
'unit','normalized','position',[0.12,0.87,0.826,0.06],...
'BackgroundColor','w','ForegroundColor','b',...
'string','这个程序有着能够看穿你心思的特殊能力,试试吧!','FontSize',14);

h_text2=uicontrol(gcf,'style','text',...
'unit','normalized','position',[0.15,0.8,0.566,0.04],...
'BackgroundColor','w','ForegroundColor','black','HorizontalAlignment',...
'left','string','<> 请你在心里默想一个小于100的数字(比方说54)',...
'FontSize',10);
aa='<> 用你刚才想到的数字分别减去其十位数和个';
bb='位数得到结果(比方说54 - 5 - 4 = 结果45)';
qq=[aa,bb];
h_text3=uicontrol(gcf,'style','text',...
'unit','normalized','position',[0.15,0.76,0.836,0.04],...
'BackgroundColor','w','ForegroundColor','black','HorizontalAlignment',...
'left','string',qq,'FontSize',10);

h_text4=uicontrol(gcf,'style','text',...
'unit','normalized','position',[0.15,0.72,0.836,0.04],...
'BackgroundColor','w','ForegroundColor','black','HorizontalAlignment',...
'left','string',...
'<> 在以下这个表格中查到你得出的结果,看看右边的符号是什么',...
    'FontSize',10);
aa='<> 请集中精力在你查到的符号上面(不要把鼠标指到上面)至少5秒钟,';
bb='然后点击下面这个魔力方块,看看预测的结果吧';
qq=[aa,bb];

h_text5=uicontrol(gcf,'style','text',...
'unit','normalized','position',[0.15,0.68,0.836,0.04],...
'BackgroundColor','w','ForegroundColor','black',...
'HorizontalAlignment','left','string',qq,'FontSize',10);

h_push1=uicontrol(gcf,'style','text',...
'unit','normalized','position',[0.64,0.48,0.16,0.04],...
'BackgroundColor','w','ForegroundColor','r',...
'HorizontalAlignment','center',...
'string','copyright: zjliu','FontSize',16);
aa='@#$%&κστωπγζθμφяжㄣㄈㄉㄌ【';
bb='】々①②③⊙∮◆◎※▲△☆★□〓№●';
astr=[aa,bb];
astr=[astr astr astr];
for m=0:9;
    for n=0:9;
        h_text5=uicontrol(gcf,'style','text',...
            'unit','normalized','position',...
        [0.82-m*0.08,0.1+n*0.03,0.038,0.028],...
            'BackgroundColor',[0.8 0.8 0.8],...
        'ForegroundColor','b','HorizontalAlignment','center',...
            'string',num2str(n*10+m),'FontSize',14);
    end
end
t=randperm(120);
astr=astr(t);
aastr=astr(1:100);
b=astr(end);

for m=0:9;
    for n=0:9;
        uicontrol(gcf,'style','text',...
            'unit','normalized','position',...
        [0.86-m*0.08,0.1+n*0.03,0.038,0.028],...
            'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor',...
        'black','HorizontalAlignment','center',...
            'string',aastr(n*10+m+1),'FontSize',14);
    end
end

for k=1:9;
        uicontrol(gcf,'style','text',...
            'unit','normalized','position',...
        [0.86-(10-k)*0.08,0.1+(k-1)*0.03,0.038,0.028],...
            'BackgroundColor',[0.8 0.8 0.8],...
        'ForegroundColor','black','HorizontalAlignment','center',...
            'string',b,'FontSize',14);
end

uicontrol(gcf,'style','text',...
    'unit','normalized','position',[0.86,0.1,0.038,0.028],...
    'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor',...
    'black','HorizontalAlignment','center',...
    'string',b,'FontSize',14);

h_text6=uicontrol(gcf,'style','text',...
'unit','normalized','position',[0.45,0.54,0.1,0.1],...
'BackgroundColor','b','ForegroundColor','r','HorizontalAlignment','center');


cc=['set(h_push1,',char(39),'string',char(39),',b);'];

h_push1=uicontrol(gcf,'style','push',...
'unit','normalized','position',[0.455,0.545,0.09,0.09],...
'BackgroundColor','g','ForegroundColor','r','HorizontalAlignment','center',...

'string','push','FontSize',16,'callback','eval(cc);');

h_text7=uicontrol(gcf,'style','text',...
'unit','normalized','position',[0.40,0.45,0.21,0.06],...
'BackgroundColor','b','ForegroundColor','r','HorizontalAlignment','center');


h_push2=uicontrol(gcf,'style','push',...
'unit','normalized','position',[0.41,0.46,0.19,0.04],...
'BackgroundColor','g','ForegroundColor','r','HorizontalAlignment','center',...

'string','try again','FontSize',14,'callback','mortar;');



--
╔═══════════════════╗
║★★★★★友谊第一  比赛第二★★★★★║
╚═══════════════════╝

※ 来源:.哈工大紫丁香 bbs.hit.edu.cn [FROM: 202.118.229.162]
※ 修改:·zjliu 於 01月02日16:18:18 修改本文·[FROM: 202.118.229.162]
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.946毫秒