Question: why do i keep getting errors in c + + code when using getline? #include #include / / / / / / / / /
why do i keep getting errors in c code when using getline?
#include
#include
Task :
#include fstream library
#include sstream library for istringstream function
#include
using namespace std;
Function prototype
bool userAuthentication;
void getCredentialsconst string prompt, string &data;
int main
Check if the user is authorized
if userAuthentication
cout "User is authenticated." endl;
else
cout "Authentication failed." endl;
return ;
Input: None
Purpose: This function authenticates a user
Output: true or false bool
Task: define the function
bool userAuthentication
Task a:
string line;
string tempUserName;
string tempPassword;
string userName; declare userName
string password; declare pw
Task b:
getCredentialsWhat is the UserName:", userName; call function userName
getCredentialsWhat is your password:", password; call funtion password
Task #
Task a:
ifstream adminFile credentialstxt;
Task b:
adminFile.opencredentialstxt;
Check if the adminFile opened successfully.
if adminFile.isopen
cout "System error in authentication. endl;
return false;
else
Task c:
while getLineadminFile line
cout Showing the content of the file
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
