Aauto 学习笔记陆续放一些自己的学习内容.docx
《Aauto 学习笔记陆续放一些自己的学习内容.docx》由会员分享,可在线阅读,更多相关《Aauto 学习笔记陆续放一些自己的学习内容.docx(55页珍藏版)》请在冰豆网上搜索。
Aauto学习笔记陆续放一些自己的学习内容
首先感谢一鹤大大的爱心,对于多么低级的问题都会耐心回答!
请勿灌水~有朋友有更好的算法或方法请不吝指点!
索引建立中...
热身运动--打印各种形状和九九乘法表
千里之行,始于足下
创建简单的应用程序
---------------------第三章---------------------
3.2变量
3.4数据类型
3.4.2使用字符串
3.4.2.3其他的字符串运算
3.4.2.4子字符串
3.4.2.5格式化字符串
3.4.2.7替换子字符串
3.4.3使用日期
3.4.3.5时间的加减
3.6创建方法
3.7方法的“作用域”及第3章总结
打印各种形状和九九乘法表
[一]打印三角形九九乘法表
1.io.open()
2.for(i=1;9){
3. for(j=1;i){
4. io.stdout.write( string.format("%d*%d=%2d ",i,j,i*j))
5. }
6. io.print('\n');
7.}
复制代码
[二]找出满足下列条件的所有三位数
①其百位数不大于2
②将个位与百位对换,得到的三位数是原三位数的两倍多
1.io.open();
2.vara,b,c,d,k,m;
3.for(a=1;2)
4.for(b=0;9)
5. for(c=0;9){
6. m=a*100+b*10+c;
7. k=c*100+b*10+a;
8. if(2*m<=k&&k<3*m)
9. {
10. io.print(m,k,k/m)
11. }
12. //
13. }
复制代码
[三]打印横5竖8的矩形
1.io.open();
2.for(i=1;5){
3. io.stdout.write(string.format("********"+'\n'));
4. }
复制代码
[四]打印横5竖8的平行四边形
1.io.open();
2.for(i=1;5){
3.for(j=1;5-i){
4. io.stdout.write(string.format(""));
5.}
6.io.stdout.write(string.format("********"+'\n'));
7.}
复制代码
[5]平行四边形2
1.io.open();
2.for(i=1;5){
3.for(j=1;i){
4. io.stdout.write(string.format(""));
5. }
6.io.stdout.write(string.format("********"+'\n'));
7.}
复制代码
[六]打印菱形
1.io.open();
2.for(i=1;5){
3.for(j=1;5-i)io.stdout.write(string.format(""));
4.
5.for(k=1;2*i-1)io.stdout.write(string.format("*"));
6.
7.io.stdout.write(string.format('\n'));
8.}
9.for(i=1;4){
10.for(j=1;i)io.stdout.write(string.format(""));
11.
12.for(k=1;9-2*i)io.stdout.write(string.format("*"));
13.
14.io.stdout.write(string.format('\n'));
15.}
复制代码
[七]打印多个菱形,好多for循环,有好方法的朋友不要吝啬指教!
/******************************************
思路:
先打印一个大的正三角,再打印小的倒三角
实际上是一个矩形,由‘*’和‘空格’组成,
4个空格+1个*号,变为3个空格+3个*号
再变为2个空格+5个*号...以此类推
******************************************/
1.io.open();
2.k=1;
3.for(z=1;5){ //控制行
4.for(i=1;8){ //控制菱形数量
5. for(j=1;5-z)io.stdout.write(string.format(""));
6. for(i=1;k)io.stdout.write(string.format("*"));
7. for(j=1;5-z)io.stdout.write(string.format(""));
8.
9. }
10.io.stdout.write(string.format('\n'));
11.k=k+2;
12.}
13.k=7;
14.for(z=1;4){ //控制行
15.for(i=1;8;1){ //控制菱形数量
16. for(j=1;z)io.stdout.write(string.format(""));
17. for(i=1;k)io.stdout.write(string.format("*"));
18. for(j=1;z)io.stdout.write(string.format(""));
19. }
20.io.stdout.write(string.format('\n'));
21.k=k-2;
22.}
复制代码
[八]打印每次加1个星号,5行.
1.io.open();
2.for(i=1;5){
3. for(i=1;10;1){
4. io.stdout.write(string.format(""));
5.
6. for(k=1;i)io.stdout.write(string.format("*"));
7.
8. }
9.io.stdout.write(string.format('\n'));
10.}
复制代码
有兴趣的朋友可以做我的习题--嗯,很多,很多。
。
。
因为工作原因,需要学习VB.NET,但快手又是一个好工具,怎么办呢,苦思冥想三天三夜,我决定。
。
。
。
。
。
。
。
一起学!
学习的方法也简单,就是看《VB.NET经典入门》,里面的例子,当做习题,用AAuto来实现。
跟我一起学的步骤也很简单:
①看题目,要做一个什么东西;
②打开AAuto,开始做;
③遇到问题了,看AAuto帮助文档,论坛里群里问高手;
④最后成功完成或没有完成,对照我下面的源码(有更好的实现方法一定要短消息告知我,共同学习提高)
先上一张图片小游戏:
“找不同”
看Win7下的VS2010界面与AAuto界面有什么不同
创建简单的应用程序1.4
一个空的AAuto窗体源文件
1.importwin;//必须首先导入win窗口支持库
2.importwin.ui;
3.importwin.ui.menu;
4.importwin.ole;
5./*DSG{{*/
6.varwinform=win.form(parent=...;min=1;bottom=249;max=1;text="AAutoForm";right=349;cls="AAU_FORM")
7.winform.add( )
8./*}}*/
9.winform.show(true);
10.win.loopMessage();
11.returnwinform;
复制代码
AAuto注释有两种:
① 多行用:
/*…*/
② 单行用:
//
VB只有1种:
'
创建简单的应用程序
需求:
1.创建一个新的窗体应用程序;
2.在Form1上添加1个Label控件,1个TextBox控件,2个Button控件;
3.Label的Name属性改为:
lblName;Text改为:
输入你的名字:
4.TextBox的Name属性改为:
txtName;Text内容:
空
5.Button1的Name属性改为:
btnOK;Text改为:
&OK
6.Button2的Name属性改为:
btnExit;Text改为:
E&xit
7.在TextBox中输入姓名,点进OK按钮,弹出对话框显示“你好,***!
欢迎来到VB.NET”
8.点击Exit退出窗口。
VB.NET
1.PublicClassForm1
2. PrivateSubbtnOK_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesbtnOK.Click
3. MessageBox.Show("你好,"&txtName.Text&"!
欢迎来到VisualBasic.NET.","HelloUserMessage")
4. EndSub
5. PrivateSubbtnExit_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesbtnExit.Click
6. Me.Close()
7. EndSub
8.EndClass
复制代码
AAuto
快手工程资源管理器->新建窗体设计器->输入名称
1.static(Label)的Name属性改为:
lblName;Text改为:
输入你的名字:
2.edit(TextBox)的Name属性改为:
edit;Text内容:
Null
3.Button1的Name属性改为:
btnOK;Text改为:
&OK
4.Button2的Name属性改为:
btnExit;Text改为:
E&xit
AAuto
1.importwin;//必须首先导入win窗口支持库
2.importwin.ui;
3.importwin.ui.menu;
4.importwin.ole;
5./*DSG{{*/
6.varwinform=win.form(parent=...;min=1;bottom=249;max=1;right=349;text="AAutoForm";cls="AAU_FORM")
7.winform.add(btnOK={bottom=180;text="&OK";left=23;right=114;top=146;font=LOGFONT(name="SimSun";h=-12);z=2;cls="button"};
8.edit={bottom=97;right=195;left=23;top=65;font=LOGFONT(name="SimSun";h=-12);z=1;text="";edge=1;cls="edit"};
9.btnExit={bottom=180;text="E&xit";left=177;right=268;top=146;font=LOGFONT(name="SimSun";h=-12);z=3;cls="button"};
10.lblName={bottom=49;text="输入你的名字:
";left=23;top=19;font=LOGFONT(name="SimSun";h=-12);transparent=1;z=0;right=190;cls="static"})
11./*}}*/
12.winform.btnExit.oncommand=function(id,event){
13. winform.close()
14.}
15.winform.btnOK.oncommand=function(id,event){
16. varstr=winform.edit.text
17. if(str="一鹤"){
18. win.msgbox("欢迎一鹤大大光临指导!
","AAuto万岁")
19. }
20. else{
21. win.msgbox("你好,"+str+"!
欢迎学习快手AAutoQuicker.","HelloUserMessage")
22. }
23.
24.}
25.winform.show(true)
26.win.loopMessage();
27.returnwinform;
复制代码
不同:
1.AAuto用“+”号链接字符串与变量,VB用“&”;
2.关闭窗口:
AAuto用winform.close(),VB用Me.Close()
3.AAuto用win.msgbox()打开消息窗口,VB用MessageBox.Show()
4.AAuto每段结束尾部有“;”号,而VB没有.
4.2变量
需求:
定义一个数字变量27,把27加1;
最后用对话框显示27加1的结果。
VB.NET
1.PublicClassForm1
2. PrivateSubbtnAdd_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesbtnAdd.Click
3. DimnAsInteger
4. n=27
5. n=n+1
6. MessageBox.Show("Valueofn+1="&n,"Variables")
7. EndSub
8.EndClass
复制代码
AAuto
1.importwin;//必须首先导入win窗口支持库
2.importwin.ui;
3.importwin.ui.menu;
4.importwin.ole;
5./*DSG{{*/
6.varwinform=win.form(parent=...;min=1;bottom=249;max=1;right=349;text="AAutoForm";cls="AAU_FORM")
7.winform.add(
8.btnAdd={bottom=140;text="Add1ton";left=123;right=225;top=108;font=LOGFONT(name="SimSun";h=-12);z=0;cls="button"}
9.)
10./*}}*/
11.winform.btnAdd.oncommand=function(id,event){
12.//win.msgbox(winform.btnAdd.text);
13. n=27;
14. n=n+1;
15. win.msgbox("Valueofn+1="+n,"Variables");
16.}//endproc
17.winform.show(true);
18.win.loopMessage();
19.returnwinform;
复制代码
不同:
1.快手不用定义变量;
3.4数据类型
AAuto中的基本数据类型分为:
"null","boolean","pointer","number",
"string","table","function","cdata","context","class"
VS2010的帮助文档:
VisualBasic→参考→VisualBasic语言参考→数据类型摘要(VB)
数字类型又分为:
整型(Integer)和浮点型,
浮点型又分为:
单精度(Single)与双精度(Double)
3.4.1常见的整型数学运算
需求:
整数的加减乘除
运算16加8,输出结果;
结果继续减2,输出结果;
再乘10,输出结果
最后除6,输出结果
VB.NET
1.PublicClassForm1
2. PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.Click
3. DimnAsInteger
4. n=16
5. n=n+8
6. MessageBox.Show("加法测试..."&n,"整数运算")
7. n=n-2
8. MessageBox.Show("减法测试..."&n,"整数运算")
9. n=n*10
10. MessageBox.Show("乘法测试..."&n,"整数运算")
11. n=n/6
12. MessageBox.Show("除法测试..."&n,"整数运算")
13. EndSub
14.EndClass
复制代码
AAuto
1.importwin;//必须首先导入win窗口支持库
2.importwin.ui;
3.importwin.ui.menu;
4.importwin.ole;
5./*DSG{{*/
6.varwinform=win.form(parent=...;min=1;bottom=249;max=1;text="AAutoForm";right=349;cls="AAU_FORM")
7.winform.add(
8.button={bottom=142;text="button";left=127;right=201;top=113;font=LOGFONT(name="SimSun";h=-12);z=0;cls="button"}
9.)
10./*}}*/
11.winform.button.oncommand=function(id,event){
12.//win.msgbox(winform.button.text);
13. n=16
14. n=n+8
15. win.msgbox("加法测试..."+n,"整数运算")
16. n=n-2
17. win.msgbox("减法测试..."+n,"整数运算")
18. n=n*10
19. win.msgbox("乘法测试..."+n,"整数运算")
20. n=n/6
21. win.msgbox("除法测试..."+n,"整数运算")
22.}
23.winform.show(true);
24.win.loopMessage();
25.returnwinform;
复制代码
总结:
AAuto与VB的加减乘除(+-*/)符号相同;
同时AAuto和VB都支持简写运算,如:
n+=8
n-=2
n*=10
n/=6
不同:
n/=6
AAuto结果是36.666666666667;而VB的结果是整数37;
应当是说AAuto是动态类型的,也可以用var关键字声明局部变量,但不需要指明类型。
实际上上面的代码并不完整,他还有一个Form1.Designer.vb
1._
2.PartialClassForm1
3.InheritsSystem.Windows.Forms.Form
4.'Form重写Dispose,以清理组件列表。
5._
6.ProtectedOverridesSubDispose(ByValdisposingAsBoolean)
7.Try
8.IfdisposingAndAlsocomponentsIsNotNothingThen
9.components.Dispose()
10.EndIf
11.Finally
12.MyBase.Dispose(disposing)
13.EndTry
14.EndSub
15.'Windows窗体设计器所必需的
16.PrivatecomponentsAsSystem.ComponentModel.IContainer
17.'注意:
以下过程是Windows窗体设计器所必需的
18.'可以使用Windows窗体设计器修改它。
19.'不要使用代码编辑器修改它。
20._
21.PrivateSubInitializeComponent()
22.Me.Button1=NewSystem.Windows.Forms.Button()
23.Me.SuspendLayout()
24.'
25.'Button1
26.'
27.Me.Button1.Location=NewSystem.Drawing.Point(61,94)
28.Me.Button1.Name="Button1"
29.Me.Button1.Size=NewSystem.Drawing.Size(110,46)
30.Me.Button1.TabIndex=0
31.Me.Button1.Text="Button1"
32.Me.Button1.UseVisualStyleBackColor=True
33.'
34.'Fo