Skip to content

Created customer class, user class and a function to try and save use… #7

Merged
merged 1 commit into from Feb 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 55 additions & 0 deletions customer.h
@@ -0,0 +1,55 @@
#include <string>
#include <vector>

std::string randomname();

std::vector<std::string> namelist = {
"Virgen Terrell",
"Irene Etchison",
"Tommie Nish",
"Marhta Guglielmo",
"Tomoko Hodak",
"Buena Canova",
"Maragret Oconnell",
"Silva Anstett",
"Lance Koonce",
"Alia Rosel",
"Joesph Weideman",
"Judy Washer",
"Benjamin Rose",
"Sabine Brant",
"Terri Scurlock",
"Shenita Astudillo",
"Sherwood Madill",
"Harriette Niemeyer",
"Maxima Zulauf",
"Marylee Ramthun",
};


class customer
{

private:
std::string name ;
std::string order ;


public:
int createcustomer(){
name = randomname();
// order =
return 0;
}

};



std::string randomname(){
int i ;
i = rand();
std::string name = namelist[i];
return name;
}

38 changes: 38 additions & 0 deletions user.h
@@ -0,0 +1,38 @@
#include <vector>
#include <iostream>
#include <fstream>
#include <string>

/*User class is a class that represents the player and will contain info
marking progress, name and current settings for the game.
*/

class user{

private:
char* name;
char* lang;
char* term;
float timeplayed;
float money;

public:
//Creates user, can be used to check if user was previously created.
user(){
const char* name = std::getenv("USER");
const char* lang = std::getenv("LANGUAGE");
const char* term = std::getenv("TERM");
float timeplayed = 0.0 ;
float money = 0.0;
};

~user(){
std::cout << "User object has been destroyed" << std::endl ;
}

char* getName() {return name;}
char* getLang() {return lang;}
char* getTerm() {return term;}
float gettimePlayed() {return timeplayed;}
};

15 changes: 15 additions & 0 deletions write.h
@@ -0,0 +1,15 @@
#include <fstream>
#include <string>
#include <iostream>
using namespace std ;

int savetoFile(string input, string filename)
{
ofstream file;
file.open(filename);
if (! file){
cout << "Error opening file for output"<< endl ;
return -1 ;}
file << input ;
return 0;
}