Visual Basic

目录

一,Visual Basic

二,控制台程序

三,可视化程序

1,IDE

2,实例——加法计算器


一,Visual Basic

Visual Basic是可视化的Basic,简称VB

VB是第一个可视化编程语言。

二,控制台程序

用visual studio可以创建VB的控制台工程,先填一个Hello world:

Module Module1

    Sub Main(args As String())
        Console.WriteLine("Hello, world!")
    End Sub

End Module

VB的控制台程序员也可以打断点、单步调试。

以atcoder的Contest 229的A - First Grid为例:

Problem Statement

We have a grid with 22 horizontal rows and 22 vertical columns.
Each of the squares is black or white, and there are at least 22 black squares.
The colors of the squares are given to you as strings S_1S1​ and S_2S2​, as follows.

  • If the j-th character of Si​ is #, the square at the i-th row from the top and j-th column from the left is black.
  • If the j-th character of Si​ is ., the square at the i-th row from the top and j-th column from the left is white.

You can travel between two different black squares if and only if they share a side.
Determine whether it is possible to travel from every black square to every black square (directly or indirectly) by only passing black squares.

Constraints

  • Each of S1​ and S2​ is a string with two characters consisting of # and ..
  • S1​ and S2​ have two or more #s in total.

Input

Input is given from Standard Input in the following format:

S1​
S2​

Output

If it is possible to travel from every black square to every black square, print Yes; otherwise, print No.


Sample Input 1 

##
.#

Sample Output 1 

Yes

It is possible to directly travel between the top-left and top-right black squares and between top-right and bottom-right squares.
These two moves enable us to travel from every black square to every black square, so the answer is Yes.


Sample Input 2 

.#
#.

Sample Output 2 

No

It is impossible to travel between the top-right and bottom-left black squares, so the answer is No.

首先用C++水一下:

#include <iostream>
#include <string>

using namespace std;

int main()
{
  string s1,s2;
  cin>>s1>>s2;
  if(s1=="#."&&s2==".#")cout<<"No";
  else if(s2=="#."&&s1==".#")cout<<"No";
  else cout<<"Yes";
  return 0;
}

然后用Visual Basic来写:

Imports System.IO

Module Module1

    Sub Main(args As String())
        Dim s1 As String
        Dim s2 As String
        s1 = Console.ReadLine()
        s2 = Console.ReadLine()
        If s1 = ("#.") And s2 = (".#") Then
            Console.WriteLine("No")
        ElseIf s2 = ("#.") And s1 = (".#") Then
            Console.WriteLine("No")
        Else
            Console.WriteLine("Yes")
        End If

    End Sub

End Module

这个代码可以AC

三,可视化程序

1,IDE

visual studio也可以做VB的可视化程序,但是我没看明白咋用。

我记得高中用的应该也是visual basic 6.0,所以在继续用这个IDE

 资源分享汇总

新建工程会有个默认窗口

左边是常用控件,如DirListBox,直接放一个在窗口里运行就可以访问本地文件,非常方便。

2,实例——加法计算器

首先放控件,3个文本框,1个按钮

 然后双击按钮,自动创建函数Check1_Click,填补函数

Option Explicit

Private Sub Check1_Click()
Text3.Text = CSng(Text1.Text) + CSng(Text2.Text)
End Sub

运行即可

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1.VB是什么? VB是visual Basic的简称,即初学者通用符号代码,是很容易入门的语言,从BASIC发展而来。 2.学VB有什么用? VB是一门编程语言,所以能用VB做的很多很多,基本上除了底层开发(系统软件),VB都能做,而且在数据库应用方面VB也有他独到的一面。 3.如何学好VB(请详细说明) 这不是一句两句可以说清楚的。给你一个学习的过程: 3.1.入门,这段时间你应该学会VB的基本语法,基本语句和基本控件等。能够写一些简单的计算程序就算可以乐。比如写一个解1元2次方程的程序,写一个求解两数的最新公约数的程序等等。 3.2.开始做VB界面的一些东西,了解控件,窗体的使用,事件,方法、过程和函数等。 3.3 开始用类设计VB程序。封装一个VB类。学会VB中类的使用方法。 3.4 学习使用API增强程序的功能。 3.5 这是转入学习C语言,不一定要很强,能懂一些语法就行,当然能够深入的话,就可以转C++乐。 3.6 有乐C的基础,就可以去学习数据结构乐。数据结构很重要,一定要学好。 3.7 开始在VB里面尝试实现数据结构,比如做一个链表,vb没有指针,所以不能向c那样做链表,但我想这时候你应该知道怎么做乐。 3.8 开始尝试做游戏,做不同的程序,做自己想做的东西。 3.9 深入VB。 VB到了这个阶段,深入是很困难的了。需要API的帮助。做一些窗口回调,挂钩等程序。 4.0 你已经有相当的VB经验了,这时候要确定一个方向了,比如游戏编程directx,比如大数据量的数学计算,人工智能等等。。。 4.1 等等等 5.VB可以作什么程序? VB能做的太多了,除不不能开发ddk程序,不能开发sys,vxd其他的基本都能做。(呵呵,开发OS肯定不行了。) ,而用VB做个图书管理系统,医院管理系统等做毕业设计,是再快速和简便不过的了,功能也可以做的非常强大,现在好多流行软件也用VB开发。当然Delphi也很好使。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值