You cannot us a function the compiler hasn't seem defined yet. So, you have two options. You can either put the function definition above your main function, like this:
#include "Login.h"
#include <windows.h>
#include <iostream>
using namespace std;
void Login();
int main()
{
srand(time(NULL));
Login(); }
void Login()
{
...
}
or move the entire Login function above main:
#include "Login.h"
#include <windows.h>
#include <iostream>
using namespace std;
void Login()
{
string userName;
string userPassword;
int loginAttempt = 0;
while (loginAttempt < 5)
{
std::cout << "Username:";
std::cin >> userName;
std::cout << "Password";
std::cin >> userPassword;
if (userName == "logintest" && userPassword == "logintest")
{
std::cout << "\nLogged in";
}
else
{
std::cout << "\nError";
}
}
}
int main()
{
srand(time(NULL));
Login(); }