首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >此BTC代码如何验证用户输入?

此BTC代码如何验证用户输入?
EN

Stack Overflow用户
提问于 2020-04-29 21:39:19
回答 1查看 61关注 0票数 3

我使用此代码获取用户输入并验证它,以增加用户钱包中的用户BTC。我需要一些代码的解释,它是如何工作的。代码:

代码语言:javascript
复制
#include <iostream>
using namespace std;
int main()
{
    int btc_input, result_btc, btc_validation, btc_validation_1_input, btc_validation_2_input;
    result_btc = 0;
    btc_validation = 0;
    btc_validation_1_input = 0;
    btc_validation_2_input = 0;
    for (; btc_validation < 3; btc_validation++)
    {
     cout << "Enter the Value " << (btc_validation + 1) << " + " ;
     cin >> btc_input;
     cout << "Enter the Value " << (btc_validation + 1) << " + " ;
     cin >> btc_input;
     btc_validation_1_input == btc_validation + btc_input;
     cout << "Enter the Value " << (btc_validation_1_input + 1) << " + " ;
     cin >> btc_validation_2_input;
     result_btc = btc_validation_1_input + btc_validation_2_input;
     result_btc *= btc_validation_2_input;
     break;
    }
    cout << result_btc << '\n';
    cout << "Your BTC Wallet is Increased by " << result_btc << " coins " << '\n';
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-04-29 22:25:20

你的代码在任何情况下都不是一个API,而是一个代码,要注意诈骗者。你拥有的代码的工作方式和我将解释的一样,通过编辑和转换你的代码,以最小的形式让你更好地理解。

代码语言:javascript
复制
#include <iostream>
using namespace std;

int main()
{
    int btc_input, result_btc, btc_validation;
    result_btc = 0;
    btc_validation = 0;
    for (; btc_validation < 3; btc_validation++)
    {
     cout << "Enter the number >> [" << btc_validation + 1 << "] " ;
     cin >> btc_input;
     result_btc += btc_input;
    }
    cout << (result_btc *= btc_input) << '\n';
    cout << "You entered " << result_btc << " numbers " << '\n';
}
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61503154

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档