classes help
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
using namespace std;
void menu();
void carregardados();
class user //saves user data
{
public:
void uservalues (string name1, string sex1, int id1, string age1, vector<int> playlist1){
name = name1;
sex = sex1;
id = id1;
age = age1;
vector<int> playlist = vector<int> playlist1;
}
string getname () {
return name;
}
string getsex () {
return sex;
}
string getage () {
return age;
}
int getid () {
return id;
}
vector<int> getplaylist () {
return playlist;
}
void addmusic (const int &id); //adds a music id to the vector playlist
void removemusic (const int &id); //removes a music id to the vector playlist
private: //define variables
string name;
int id;
string age;
string sex;
vector<int> playlist;
};
int main()
{
carregardados();
menu();
}
void menu()
{
int x;
vector<user> utilizadores;
cout<<"1 - Login"<<endl;
cout<<"2 - Register"<<endl;
cin>>x;
}
void carregardados()
{
ifstream file ( "users.csv" ); // declare file stream:
string value;
while ( file.good() )
{
getline ( file, value, ',' );// read a string until next comma:
// display value removing the first and the last character from it
}
}
|
This gives me an error-expected a ";" on this line: vector<int> playlist = vector<int> playlist1;
replace this line
vector<int> playlist = vector<int> playlist1;
with this line
vector<int> playlist = playlist1;
playlist1 is already initialized.
omg thanks youre my idol ^^
Topic archived. No new replies allowed.