Anyone please take a look at the set() ... i don't know what went wrong that string in the set() gave me compile error saying undeclared identifier, which shouldn't even be a variable
# include <iostream>
# include <string>
# include <fstream>
using namespace std;
class Name
{
public:
int id;
string lastName;
string firstName;
string phone;
double amt;
void output();
void set(int, string, string, string, double);
};
int main()
{
Name name[300];
/*
ifstream reader;
reader.open("names.txt");
int i=0;
while(reader>>name[i].id>>name[i].lastName>>name[i].firstName>>name[i].phone>>name[i].amt)
{
i++;
}
*/
name[0].set(123, aLastName, aFirstName, 617-538-2888, 1000.00); // aLastName and aFirstName gave compiling error...
/*
for(int x=i-1; x>-1; x--)
{
name[x].output();
}
*/
return 0;
}
void Name::output()
{
cout<<id<<" "<<lastName<<" "<<firstName<<" "<<phone<<" "<<amt<<endl;
}
void Name::set(int inputID, string inputLastName, string inputFirstName, string inputPhone, double inputAmount)
{
id= inputID;
lastName = inputLastName;
firstName = inputFirstName;
phone= inputPhone;
amt = inputAmount;
}