Question: Add the article class as a . txt file or text file, just like the user class. User class #include #include #include using namespace std;
Add the article class as atxt file or text file, just like the user class.
User class
#include
#include
#include
using namespace std;
class User
private:
string username;
string password;
public:
Userconst string & user, const string & pass : usernameuser passwordpass
bool authenticateconst string & inputUser, const string & inputPass const
return username inputUser && password inputPass;
static bool validateUserconst string & inputUser, const string & inputPass
ifstream fileusertxt;
if file.isopen
cerr "Error opening file" endl;
return false;
string storedUser, storedPass;
while file storedUser storedPass
if storedUser inputUser && storedPass inputPass
return true;
return false;
;
Main
int main
vector items
ItemPaper
ItemFeather
ItemLaptop
ItemPencil
ItemDraft
;
vector cart;
switch choice
case :
int subChoice;
cout View items below a certain price" endl;
cout View items above a certain price" endl;
cout Search by name" endl;
cout "Enter your choice: ;
cin subChoice;
if subChoice subChoice
double priceLimit;
cout "Enter price limit: ;
cin priceLimit;
cout "Available items:
;
for int i ; i items.size; i
if subChoice && itemsigetPrice priceLimitsubChoice && itemsigetPrice priceLimit
cout i itemsigetName Price: $ itemsigetPrice endl;
else if subChoice
string itemName;
cout "Enter item name: ;
cin itemName;
for const auto & item : items
if itemgetName itemName
cout "Item: item.getName Price: $ item.getPrice endl;
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
