Я попробовал все на Google и Duckduckgo.Я просто сдался и пришел к вам, чтобы задать вопрос.
Я работаю над проектом по изучению CPP и попал в проблему.У меня есть 2 файла.
Один называется: Nudle.cpp (основной)
// Nudle.cpp : This file contains the 'main' function. Program execution begins and ends there.
#include <fstream>
#include <iostream>
#include "PasGen.cpp"
#include "PasGen.h"
using namespace std;
int main(int argc, char* argv[])
{
int choice;
do {
cout << "NUDLE Menu\n";
cout << "Please make your selection\n";
cout << " 1 - Generate password\n";
cout << " 2 - View Saved Passwords\n";
cout << " 3 - Quit\n";
cout << "Selection = ";
cin >> choice;
switch (choice) {
case 1:
break;
case 2:
cout << "????\n";
break;
case 3:
cout << "Goodbye!";
break;
default:
cout << endl << endl << "Main Menu\n";
cout << "Please make your selection\n";
cout << " 1 - Start game\n";
cout << " 2 - Options\n";
cout << " 3 - Quit\n";
cout << "Selection = ";
cin >> choice;
}
} while (choice != 3);
return EXIT_SUCCESS;
, а другой - PasGen.cpp (генератор паролей)
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
static const char alphnum[] = "0123456789" "!@#$%^&*" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz";
int strLen = sizeof(alphnum) - 1;
char GenRand()
{
return alphnum[rand() % strLen];
}
int PassGen()
{
int n, c = 0, s = 0;
srand(time(0));
cout << "Enter the length of the password required:";
cin >> n;
cout << n << endl;
cout << "Your Password is:";
N:
char C;
string D;
for (int z = 0; z < n; z++)
{
C = GenRand();
D += C;
if (isdigit(C))
{
c++;
}
if (C == '!' || C == '@' || C == '$' || C == '%' || C == '^' || C == '&' || C == '*' || C == '#')
{
s++;
}
}
if (n > 2 && (s == 0 || c == 0))
{
goto N;
}
cout << D;
}
и я просто не могу понять, как заставить Nudle запустить PasGen после того, как человек запрашивает Генератор паролей
И я хочу, чтобы он выводил вывод на ту же консоль, а не открывалновый.
Администраторы, пожалуйста, не закрывайте мою ветку, если она уже существует.Я был почти все шаги и до сих пор не могу понять