求一个汇编小程序

求一个汇编小程序,第1张

#include <iostream.h>

#include <iomanip.h>

#include <string.h>

#include <fstream.h>

const int Maxr=100 //读者上限

const int Maxb=100 //图书上限

const int Maxbor=5 //每个读者最多借借5本

class Reader //读者类

{

int tag //删除标记 1:已删,0:未删

int no //读者编号

char name[10] //读者姓名

int borbook[Maxbor] //所借图书

public:

Reader() {}

char *getname() {return name} //获取姓名

int gettag() {return tag} //获取删除标记

int getno() {return no} //获取读者编号

void setname(char na[]) //设置姓名

{

strcpy(name,na)

}

void delbook() {tag=1} //设置删除标记

void addreader(int n,char *na) //增加读者

{

tag=0

no=n

strcpy(name,na)

for (int i=0i<Maxbori++)

borbook[i]=0

}

void borrowbook(int bookid) //借书 *** 作

{

for (int i=0i<Maxbori++)

{

if (borbook[i]==0)

{

borbook[i]=bookid

return

}

}

}

int retbook(int bookid) //还书 *** 作

{

for (int i=0i<Maxbori++)

{

if (borbook[i]==bookid)

{

borbook[i]=0

return 1

}

}

return 0

}

void disp() //输出读者信息

{

cout<<setw(5)<<no<<setw(10)<<name<<"借书编号:["

for (int i=0i<Maxbori++)

if (borbook[i]!=0)

cout<<borbook[i]<<"|"

cout<<"]"<<endl

}

}

class RDatabase //读者库类

{

int top //读者记录指针

Reader read[Maxr] //读者记录

public:

RDatabase() //构造函数,将reader.txt读到read[]中

{

Reader s

top=-1

fstream file("reader.txt",ios::in)

while (1)

{

file.read((char *)&s,sizeof(s))

if (!file) break

top++

read[top]=s

}

file.close()

}

void clear() //删除所有读者信息

{

top=-1

}

int addreader (int n,char *na) //添加读者时先查找是否存在

{

Reader *p=query(n)

if (p==NULL)

{

top++

read[top].addreader(n,na)

return 1

}

return 0

}

Reader *query(int readerid) //按编号查找

{

for (int i=0i<=topi++)

if (read[i].getno()==readerid &&read[i].gettag()==0)

return &read[i]

return NULL

}

void disp() //输出所有读者信息

{

for (int i=0i<=topi++)

read[i].disp()

}

void readerdata() //读者库维护

~RDatabase() //析构函数,将read[]写入reader.txt文件中

{

fstream file("reader.txt",ios::out)

for (int i=0i<=topi++)

if (read[i].gettag()==0)

file.write((char *)&read[i],sizeof(read[i]))

file.close()

}

}

void RDatabase::readerdata()

{

int choice=1

char rname[20]

int readerid

Reader *r

while (choice!=0)

{

cout<<"读者维护 1:新增 2:更改 3:删除 4:查找 5:显示 6:全删 0:退出=>"

cin>>choice

switch (choice)

{

case 1:

cout<<"输入读者编号:"

cin>>readerid

cout<<"输入读者姓名:"

cin>>rname

addreader(readerid,rname)

break

case 2:

cout<<"输入读者编号:"

cin>>readerid

r=query(readerid)

if (r==NULL)

{

cout<<"该读者不存在"<<endl

break

}

cout<<"输入新的姓名:"

cin>>rname

r->setname(rname)

break

case 3:

cout<<"输入读者编号:"

cin>>readerid

r=query(readerid)

if (r==NULL)

{

cout<<"该读者不存

VB6:

你可以在工程里多建一个窗体, *** 作的菜单写在这里,不显示9 OK了

当你要的窗体关闭后 再+载托盘

VB.NET里直接9有Closing和Closed事件

以下9是托盘:

Dim OldWindowProc As Long

Dim TheForm As Form

Dim TheMenu As Menu

Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _

(ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, _

ByVal wParam As Long, ByVal lParam As Long) As Long

Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _

(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Declare Function GetWindowLong Lib "user32" Alias _

"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long

Declare Function SetLayeredWindowAttributes Lib "user32" _

(ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, _

ByVal dwFlags As Long) As Long

Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" _

(ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long

Type NOTIFYICONDATA

cbSize As Long

hwnd As Long

Uid As Long

UFlags As Long

UCallbackMessage As Long

HIcon As Long

SzTip As String * 64

End Type

Private TheData As NOTIFYICONDATA

Public Function NewWindowProc(ByVal hwnd As Long, ByVal Msg As Long, _

ByVal wParam As Long, ByVal lParam As Long) As Long

If Msg = (&H400 + 1001&) Then

If lParam = &H205 Then

FormM.SetFocus

TheForm.PopupMenu TheMenu

Exit Function

End If

End If

NewWindowProc = CallWindowProc(OldWindowProc, hwnd, Msg, wParam, lParam)

End Function

Public Sub AddToTray(frm As Form, mnu As Menu)

Set TheForm = frm

Set TheMenu = mnu

OldWindowProc = SetWindowLong(frm.hwnd, (-4), AddressOf NewWindowProc)

With TheData

.Uid = 0

.hwnd = frm.hwnd

.cbSize = Len(TheData)

.HIcon = frm.Icon.Handle

.UFlags = 2

.UCallbackMessage = (&H400 + 1001&)

.UFlags = .UFlags Or 1

.cbSize = Len(TheData)

End With

Shell_NotifyIcon 0, TheData

End Sub

Public Sub RemoveFromTray()

With TheData

.UFlags = 0

End With

Shell_NotifyIcon 2, TheData

SetWindowLong TheForm.hwnd, (-4), OldWindowProc

End Sub

Public Sub SetTrayTip(tip As String)

With TheData

.SzTip = tip &vbNullChar

.UFlags = 4

End With

Shell_NotifyIcon 1, TheData

End Sub

页面产生点击事件(例如button上bindtap的回调中)后才可调用,每次请求都会d出授权窗口,用户同意后返回userInfo。

每次通过该接口获取用户个人信息均需用户确认

    wx.getUserProfile({

            desc: '展示用户信息', // 声明获取用户个人信息后的用途

            success: ({userInfo:{nickName,avatarUrl}}) =>{

            //  console.log(res)

            //  nickName 用户昵称,avatarUrl 用户头像图片地址

              this.setData({

                nickName,

                avatarUrl,

                flag:false

              })

            }

        })

  <van-dropdown-menu>

    <van-dropdown-item value="{{ value1 }}" options="{{ option1 }}"  bind:change="onSwitch1Change"/>

    <van-dropdown-item value="{{ value2 }}" options="{{ option2 }}" bind:change="onSwitch2Change" />

  </van-dropdown-menu>

data:{

option2: [

      { text: '评论排序', value: 0},

      { text: '评论倒序', value: 1 }

    ],

    value1: 0,

    value2: 0

}

onSwitch1Change({ detail }) {

    this.data.page=1

    this.setData({

      value1:detail,

      value2:0

    })

    this.init()

  },

  onSwitch2Change({ detail }) {

    this.data.page=1

    this.setData({

      value2:detail,

      value1:0

    })

    this.init()

  },

 logout(){

    logoutHttp()

    .then(res=>{

      wx.clearStorageSync('token')

      wx.navigateTo({

        url: '/pages/login/login',

      })

    })

    .catch(err=>{

      console.log(err)

    })

  }

    let flag1=this.checkFn('nichen','nichenErr','昵称不能为空')

    let flag2=this.checkFn('email','emailErr','邮箱不能为空')

    let flag3=this.checkFn('pwd','pwdErr','密码不能为空')

    let flag4=this.checkFn('repwd','repwdErr','确认密码不能为空')

    if(!this.data[name].trim()){

      this.setData({

        [errkey]:errstr

      })

      return false

    }else{

      this.setData({

        [errkey]:''

      })

      return true

    }


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/11694864.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存