Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- rabbit_nando
- V.1.1
- Gerador de cpf
- Linguagem: C++
- Script que gera uma sequencia de numeros simulando numeros de CPF.
- */
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main()
- {
- int num[9],sm1,sm2,i,cpf,quant;
- cout << "\n\t###################################\n";
- cout << "\n\t####### -Gerador de cpf V.1- ######\n";
- cout << "\n\t###################################\n";
- //Gerando os numeros de CPF
- quant = 0;
- while(quant < 1)
- {
- cout << "Digite um numero: ";
- cin >> quant;
- for(cpf = 1; cpf <= quant; cpf++)
- {
- srand(time(NULL));
- for(i = 1; i <= 9; i++)
- {
- num[i] = rand()%9; // gerando numeros aleatorios entre 0 e 9
- }
- }
- }
- //Primeiro digito
- sm1 = 1;
- sm1 = rand()%9;
- //Segundo digito
- sm2 = 1;
- sm2 = rand()%9;
- //Imprime CPF
- for(i = 1; i <= 9; i++)
- {
- cout << num[i];
- if(i - 1 == 2 ) cout << ".";
- if(i - 1 == 5 ) cout << ".";
- }
- cout << "\nOs dois ultimos digitos " << sm1 << " " << sm2;
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement