As an intern at Amazon, you have been assigned a task to implement the sign-in pages inthe Amazon Dummy Website. There are three sign-in pages, each with its own APl:
Register | Login | Logout | |
---|---|---|---|
Function | Registers a newuser with the username and password | Verifies the username and password, then grants or denies access | username logs out of the website |
API Request | register <username> <password> | login <username> <password> | logout <username> |
Returns | 1.lf the registrationwas successful,Registered Successfully 2.lf the user already exists,Username already exists |
1.lf the login was successful, Logged In Successfully 2.If the login was unsuccessful,Login Unsuccessful |
lf the logout was successful, Logged Out Successfully lf the given username wasn't logged in, Logout Unsuccessful |
Given a log of APl requests, return the list of returns from the mock website.
step1:题目简化
实现一个用户注册登录逻辑
step2:思路:模拟
1.先读入数据,按空格分割字符串。这里对于cpp/c选手最麻烦。其他语言都有封装好的split函数
本题属于以下题库,请选择所需题库进行购买