当前位置:网站首页>Full arrangement of numbers (digital password dictionary)
Full arrangement of numbers (digital password dictionary)
2022-06-12 09:08:00 【Record dada I】
Digital password dictionary
Number selection space :0-9
do n A complete arrangement of digits
Console output :
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
int num=1;
for(int i =1; i<n; i++) {
num=num*10;// Calculate the start bit
}
int sum=num*10-1;// Calculation end bit
for(int i =0; i<=sum; i++) {
cout<<setw(n)<<setfill('0')<<i<<endl;// common n position , The front is not enough to fill zero , single quote
}
return 0;
}
Write it to the file :
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
int num=1;
ofstream write;// Define variables written to the file
write.open("password.txt");// Indicates that you want to output the content to “password.txt" In this document If you don't have this file , This file will be created automatically
for(int i =1; i<n; i++) {
num=num*10;// Calculate the start bit
}
int sum=num*10-1;// Calculation end bit
int j=0;
for(int i =0; i<=sum; i++) {
write<<setw(n)<<setfill('0')<<i<<endl;// common n position , The front is not enough to fill zero , single quote
j++;// Count the number of generated passwords
}
write.close();// Close input stream
cout<<" Output complete , Generate password altogether :"<<j;
return 0;
}
边栏推荐
- Jupyter notebook sets the default browser to open with an error syntaxerror: (Unicode error) 'UTF-8' codec can't decode byte 0xd4
- Background position - mixed units
- Does database and table splitting cause reading diffusion problems? How to solve it?
- Permutation (greedy strategy)
- Description of string
- Building a cluster: and replacing with error
- 数据库不知道哪里出问题
- ISCSI详解(五)——ISCSI客户端配置实战
- 第六章-包含多个段的程序
- 解压缩zip文件的工具类
猜你喜欢

MFS explanation (IV) -- MFS management server installation and configuration
![[character set 8] char8_ t、char16_ t、char32_ t、wchar、char](/img/ef/e57fb345b36c84d3585fca0568b0ee.png)
[character set 8] char8_ t、char16_ t、char32_ t、wchar、char

MFS详解(四)——MFS管理服务器安装与配置
![[computer use] how to change a computer disk into a mobile disk?](/img/ff/843f4220fcaefc00980a6edc29aebf.jpg)
[computer use] how to change a computer disk into a mobile disk?

Node sample background setup

Analysis of 43 cases of MATLAB neural network: Chapter 7 regression of RBF Network -- Realization of nonlinear function regression

Load the source code of 2D 3D virtual anchor in the web page (1: project introduction and source code)

Definition of polar angle and its code implementation

2022 low voltage electrician retraining question bank and online simulation examination

Box model border
随机推荐
Background fixing effect
Notes used by mqtt (combined with source code)
Counting haybales (difference + discretization)
Latex common symbols summary
(JS) three digits are separated by commas, and two decimal places are reserved (or rounded)
2024. 考试的最大困扰度-滑动窗口
Binlog in mysql:
List < string > sort
最少换乘次数
剑指 Offer II 016. 不含重复字符的最长子字符串-滑动窗口
IDEA新版UI申请方法+无测试资格使用方法及相关介绍
POI library update excel picture
域名映射到指定IP
Background position - mixed units
Background location case II
128. 最长连续序列-哈希表
Does database and table splitting cause reading diffusion problems? How to solve it?
torch.logical_and()方法
Unittest test framework
Flink CheckPoint : Exceeded checkpoint tolerable failure threshold