473,810 Members | 3,135 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Beg Class challenge for a returning student

I'm so frustrated. I'm beginning school next week and I have been working
on a simple program for several days now without being able to complete it.
(Though I have brushed up on a lot of C++ while trying.)

I realize this code is long but, I'm not sure of any other way to display
the issue.

The header file and ?implementation file work. (This assignment was
building on another in which I created the header and implementation with a
simple executable, i.e. display the read data.)

This executable is supposed to 1. create an array of Patient objects, then
2. present a user menu to a. read Patient data from a user specified file,
b. display data. c. quit program.

Facts: max patients = 1000.

Requirements: cannot change header or implement file; use an array; handle
user errors

So here it is, any assistance would be extremely appreciated.

HEADER
#ifndef PATIENT_H
#define PATIENT_H

#include <iostream>
#include <string>

using namespace std;

class Patient
{
public:
Patient();
Patient(string fName, string lName, string idString, int bYear);

string getName() const;
int getAge() const;
string getID() const;

void setFirstName (string fname);
void setLastName (string lname);
void setID(string idString);
void setBirthYear(in t bYear);
private:
string firstName;
string lastName;
string ID;
int birthYear;
};
#endif

HEADER DEFINITIONS
#include <iostream>
#include <string>
#include "patient.h"

using namespace std;

Patient::Patien t() {
setFirstName("F irst");
setLastName("La st");
setID("Z9999");
setBirthYear(99 99);
}
Patient::Patien t(string fName, string lName, string idString, int bYear) {
setFirstName(fN ame);
setLastName(lNa me);
setID(idString) ;
setBirthYear(bY ear);
}
string Patient::getNam e() const {
return lastName + ", " + firstName;
}
int Patient::getAge () const {
return birthYear;
}
string Patient::getID( ) const {
return ID;
}
void Patient::setFir stName(string fName) {
firstName = fName;
}
void Patient::setLas tName(string lName) {
lastName = lName;
}
void Patient::setID( string idString) {
int i = idString.size() ;
if (i == 5) {
ID = idString;
}
else {
cerr <<"\nIllegal Patient ID: " <<idString<<" using Z9999"<<endl;
ID = "Z9999";
}
}
void Patient::setBir thYear(int Year) {
if ((Year >1873) && (Year < 2003)) {
birthYear = 2003 - Year;
}
else {
cerr<<"\nIllega l Year: "<<Year<<" using 9999"<<endl;
birthYear = 9999;
}
}

**** Problem Driver ***********
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include "patient.h"

using namespace std;

char resp;
void GetList();
bool getPatient(ifst ream &fin, Patient &P);
const int MaxPatientSize = 1000;

int main()
{

Patient P[MaxPatientSize];
GetList();

do{
cout <<"\nWould you like to read another Patient File? (y or n):";
cin >> resp;
}while ((resp != 'y') && (resp != 'Y') && (resp != 'n') && (resp != 'N'));
if ((resp == 'y') || (resp == 'Y'))
GetList();
else
cout <<"Good Bye!"<< endl;

return 0;
}
void GetList()
{
cout<<"Enter name of Patient List to be read: ";
cin.getline(
ifstream fin(file_name.c _str());
if (!fin)
{
cerr<<"\nCannot open Patient List. Good Bye\n";
exit(1);
}
do
{
cout<<"Would you like to display your Patient List? (y or n): ";
cin >> resp;
}while ((resp != 'y') && (resp != 'Y') && (resp != 'n') && (resp !=
'N'));
if ((resp == 'y') || (resp == 'Y'))
{
for (P = Patient(),
while(getPatien t(fin, P))
{
cout<<"\n\n\n"< <setw(25) <<setiosflags(i os::left)<<"Pat ient Name"
<<setw(20)
<<setiosflags(i os::left)<<"Pat ient ID" <<setw(15)
<<setiosflags(i os::left)<<"Pat ient Age"<<endl;
cout <<setw(25)<<set iosflags(ios::l eft)<<P.getName () <<setw(20)
<<setiosflags(i os::left)<<P.ge tID() <<setw(15)
<<setiosflags(i os::left)<<P.ge tAge()<<"\n\n";

fin.close();
P = Patient();
}
else
return;
}
bool getPatient(ifst ream &fin, Patient &P)
{
bool isOK = true;
string name = "";

if (getline(fin, name, '\n') && isOK)
fam.setFirstNam e(name);
else
isOK = false;

if (getline(fin, name, '\n') && isOK)
fam.setLastName (name);
else
isOK = false;

if (getline(fin, name, '\n') && isOK)
fam.setID(name) ;
else
isOK = false;

/*f (getline(fin, name, '\n') && isOK)
fam.setBirthYea r(name);
else
isOK = false; */

return isOK;
}

Jul 22 '05 #1
4 1680
"mchoya" <mi******@sbcgl obal.net> wrote in message
news:ah******** ****@newssvr16. news.prodigy.co m...
I'm so frustrated. I'm beginning school next week and I have been working
on a simple program for several days now without being able to complete it. (Though I have brushed up on a lot of C++ while trying.)

I realize this code is long but, I'm not sure of any other way to display
the issue.
You haven't told us what issues you're having.

The header file and ?implementation file work. (This assignment was
building on another in which I created the header and implementation with a simple executable, i.e. display the read data.)

This executable is supposed to 1. create an array of Patient objects, then
2. present a user menu to a. read Patient data from a user specified file,
b. display data. c. quit program.

Facts: max patients = 1000.

Requirements: cannot change header or implement file; use an array; handle
user errors

So here it is, any assistance would be extremely appreciated.


Tell us what problems you're having. Be specific.

-Mike
Jul 22 '05 #2
On Sun, 29 Aug 2004 17:22:14 GMT, "mchoya" <mi******@sbcgl obal.net>
wrote:
I'm so frustrated. I'm beginning school next week and I have been working
on a simple program for several days now without being able to complete it.
(Though I have brushed up on a lot of C++ while trying.)

I realize this code is long but, I'm not sure of any other way to display
the issue.

The header file and ?implementation file work. Yes, the .cpp file is called the implementation file.
(This assignment was
building on another in which I created the header and implementation with a
simple executable, i.e. display the read data.)

This executable is supposed to 1. create an array of Patient objects, then
2. present a user menu to a. read Patient data from a user specified file,
b. display data. c. quit program.

Facts: max patients = 1000.

Requirements : cannot change header or implement file; use an array; handle
user errors

So here it is, any assistance would be extremely appreciated. Help us to help you by clearly explaining the problem you are having.
I will give some comments but since I do not know what problem you
want us to look at, I do not know if my comments are relevant.

HEADER
#ifndef PATIENT_H
#define PATIENT_H

#include <iostream> Why are you including iosteam? You do not use it in this file.
#include <string>

using namespace std; AAARRGGGHHHH! NEVER put this in a header file. You are likely to
give yourself big problems with clashing names if you do this with any
sort of sizeable program. By doing this you undo all the good work
that namespaces can do for you by keeping names separate.

class Patient
{
public:
Patient();
Patient(string fName, string lName, string idString, int bYear);

string getName() const;
int getAge() const;
string getID() const;

void setFirstName (string fname);
void setLastName (string lname);
void setID(string idString);
void setBirthYear(in t bYear);
private:
string firstName;
string lastName;
string ID;
int birthYear;
};
#endif

HEADER DEFINITIONS
#include <iostream>
#include <string>
#include "patient.h"

using namespace std;

Patient::Patie nt() {
setFirstName("F irst");
setLastName("La st");
setID("Z9999");
setBirthYear(99 99);
} A point of style, better to use some vertical space to separate
functions, it makes the code easieer to read. Also on a point of
style, it is unusual to use as little as one space for indentation,
three or four is more usual.
Patient::Patie nt(string fName, string lName, string idString, int bYear) {
setFirstName(fN ame); You don't have to use the functions, you can assign directly to the
data if you want. setLastName(lNa me);
setID(idString) ;
setBirthYear(bY ear);
}
string Patient::getNam e() const {
return lastName + ", " + firstName;
} All these one-liners are ideal for inlining.int Patient::getAge () const {
return birthYear;
}
string Patient::getID( ) const {
return ID;
}
void Patient::setFir stName(string fName) {
firstName = fName;
}
void Patient::setLas tName(string lName) {
lastName = lName;
}
void Patient::setID( string idString) {
int i = idString.size() ;
if (i == 5) {
ID = idString;
}
else {
cerr <<"\nIllegal Patient ID: " <<idString<<" using Z9999"<<endl;
ID = "Z9999";
}
}
void Patient::setBir thYear(int Year) {
if ((Year >1873) && (Year < 2003)) {
birthYear = 2003 - Year;
}
else {
cerr<<"\nIllega l Year: "<<Year<<" using 9999"<<endl;
birthYear = 9999;
}
}

**** Problem Driver ***********
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include "patient.h"

using namespace std;

char resp;
void GetList();
bool getPatient(ifst ream &fin, Patient &P);
const int MaxPatientSize = 1000;

int main()
{

Patient P[MaxPatientSize];
GetList();

do{
cout <<"\nWould you like to read another Patient File? (y or n):";
cin >> resp;
}while ((resp != 'y') && (resp != 'Y') && (resp != 'n') && (resp != 'N'));
if ((resp == 'y') || (resp == 'Y'))
GetList();
else
cout <<"Good Bye!"<< endl;

return 0;
}
void GetList()
{
cout<<"Enter name of Patient List to be read: ";
cin.getline( You have missed off the parameters, closing parenthesis and semicolon.
You compiler should start complaining about this point. Please
either post compilable code or copy the compiler's messages along with
the code.
ifstream fin(file_name.c _str());
if (!fin)
{
cerr<<"\nCannot open Patient List. Good Bye\n";
exit(1);
}
do
{
cout<<"Would you like to display your Patient List? (y or n): ";
cin >> resp;
}while ((resp != 'y') && (resp != 'Y') && (resp != 'n') && (resp !=
'N'));
if ((resp == 'y') || (resp == 'Y'))
{
for (P = Patient(), You have left off much of this for statement. Again your compiler
should be complaining.
while(getPatien t(fin, P))
{
cout<<"\n\n\n"< <setw(25) <<setiosflags(i os::left)<<"Pat ient Name"
<<setw(20)
<<setiosflags(i os::left)<<"Pat ient ID" <<setw(15)
<<setiosflags(i os::left)<<"Pat ient Age"<<endl;
cout <<setw(25)<<set iosflags(ios::l eft)<<P.getName () <<setw(20)
<<setiosflags(i os::left)<<P.ge tID() <<setw(15)
<<setiosflags(i os::left)<<P.ge tAge()<<"\n\n";

fin.close();
P = Patient();
}
else
return;
}
bool getPatient(ifst ream &fin, Patient &P)
{
bool isOK = true;
string name = "";

if (getline(fin, name, '\n') && isOK) getline defaults to '\n' as delimiter so it is not necessary to
include it explicitly. fam.setFirstNam e(name); What is "fam"? Where is it defined? Your compiler should be
complaining about fam also.
else
isOK = false;

if (getline(fin, name, '\n') && isOK)
fam.setLastName (name);
else
isOK = false;

if (getline(fin, name, '\n') && isOK)
fam.setID(name) ;
else
isOK = false;

/*f (getline(fin, name, '\n') && isOK)
fam.setBirthYea r(name);
else
isOK = false; */

return isOK;
}


rossum
--

The ultimate truth is that there is no Ultimate Truth
Jul 22 '05 #3
Of course your right, sorry.

Well, I'm receiveing "unresolved external links" to the header file getAge,
getID, getName.

But , I guess I'm looking for direction in the following, regarding the
executable file:
can I declare an array while initializing an object; ex: Patient
P[MaxSize], where MaxSize has been declared.(my goal being to limit the
number of Patient files (think hospital beds) to MaxSize
have I chosen appropriate parameters for the function getList in the
executable file

Thanks

"mchoya" <mi******@sbcgl obal.net> wrote in message
news:ah******** ****@newssvr16. news.prodigy.co m...
I'm so frustrated. I'm beginning school next week and I have been working
on a simple program for several days now without being able to complete it. (Though I have brushed up on a lot of C++ while trying.)

I realize this code is long but, I'm not sure of any other way to display
the issue.

The header file and ?implementation file work. (This assignment was
building on another in which I created the header and implementation with a simple executable, i.e. display the read data.)

This executable is supposed to 1. create an array of Patient objects, then
2. present a user menu to a. read Patient data from a user specified file,
b. display data. c. quit program.

Facts: max patients = 1000.

Requirements: cannot change header or implement file; use an array; handle
user errors

So here it is, any assistance would be extremely appreciated.

HEADER
#ifndef PATIENT_H
#define PATIENT_H

#include <iostream>
#include <string>

using namespace std;

class Patient
{
public:
Patient();
Patient(string fName, string lName, string idString, int bYear);

string getName() const;
int getAge() const;
string getID() const;

void setFirstName (string fname);
void setLastName (string lname);
void setID(string idString);
void setBirthYear(in t bYear);
private:
string firstName;
string lastName;
string ID;
int birthYear;
};
#endif

HEADER DEFINITIONS
#include <iostream>
#include <string>
#include "patient.h"

using namespace std;

Patient::Patien t() {
setFirstName("F irst");
setLastName("La st");
setID("Z9999");
setBirthYear(99 99);
}
Patient::Patien t(string fName, string lName, string idString, int bYear) {
setFirstName(fN ame);
setLastName(lNa me);
setID(idString) ;
setBirthYear(bY ear);
}
string Patient::getNam e() const {
return lastName + ", " + firstName;
}
int Patient::getAge () const {
return birthYear;
}
string Patient::getID( ) const {
return ID;
}
void Patient::setFir stName(string fName) {
firstName = fName;
}
void Patient::setLas tName(string lName) {
lastName = lName;
}
void Patient::setID( string idString) {
int i = idString.size() ;
if (i == 5) {
ID = idString;
}
else {
cerr <<"\nIllegal Patient ID: " <<idString<<" using Z9999"<<endl;
ID = "Z9999";
}
}
void Patient::setBir thYear(int Year) {
if ((Year >1873) && (Year < 2003)) {
birthYear = 2003 - Year;
}
else {
cerr<<"\nIllega l Year: "<<Year<<" using 9999"<<endl;
birthYear = 9999;
}
}

**** Problem Driver ***********
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include "patient.h"

using namespace std;

char resp;
void GetList();
bool getPatient(ifst ream &fin, Patient &P);
const int MaxPatientSize = 1000;

int main()
{

Patient P[MaxPatientSize];
GetList();

do{
cout <<"\nWould you like to read another Patient File? (y or n):";
cin >> resp;
}while ((resp != 'y') && (resp != 'Y') && (resp != 'n') && (resp != 'N')); if ((resp == 'y') || (resp == 'Y'))
GetList();
else
cout <<"Good Bye!"<< endl;

return 0;
}
void GetList()
{
cout<<"Enter name of Patient List to be read: ";
cin.getline(
ifstream fin(file_name.c _str());
if (!fin)
{
cerr<<"\nCannot open Patient List. Good Bye\n";
exit(1);
}
do
{
cout<<"Would you like to display your Patient List? (y or n): ";
cin >> resp;
}while ((resp != 'y') && (resp != 'Y') && (resp != 'n') && (resp !=
'N'));
if ((resp == 'y') || (resp == 'Y'))
{
for (P = Patient(),
while(getPatien t(fin, P))
{
cout<<"\n\n\n"< <setw(25) <<setiosflags(i os::left)<<"Pat ient Name"
<<setw(20)
<<setiosflags(i os::left)<<"Pat ient ID" <<setw(15)
<<setiosflags(i os::left)<<"Pat ient Age"<<endl;
cout <<setw(25)<<set iosflags(ios::l eft)<<P.getName () <<setw(20)
<<setiosflags(i os::left)<<P.ge tID() <<setw(15)
<<setiosflags(i os::left)<<P.ge tAge()<<"\n\n";

fin.close();
P = Patient();
}
else
return;
}
bool getPatient(ifst ream &fin, Patient &P)
{
bool isOK = true;
string name = "";

if (getline(fin, name, '\n') && isOK)
fam.setFirstNam e(name);
else
isOK = false;

if (getline(fin, name, '\n') && isOK)
fam.setLastName (name);
else
isOK = false;

if (getline(fin, name, '\n') && isOK)
fam.setID(name) ;
else
isOK = false;

/*f (getline(fin, name, '\n') && isOK)
fam.setBirthYea r(name);
else
isOK = false; */

return isOK;
}

Jul 22 '05 #4
Thanks.

top-post.
don't
Please

mchoya wrote:
[Re-arranged]
"mchoya" <mi******@sbcgl obal.net> wrote in message
news:ah******** ****@newssvr16. news.prodigy.co m...
[snip]
This executable is supposed to 1. create an array of Patient objects, then
2. present a user menu to a. read Patient data from a user specified file,
b. display data. c. quit program.

Facts: max patients = 1000.

Requirement s: cannot change header or implement file; use an array; handle
user errors

So here it is, any assistance would be extremely appreciated.

HEADER
#ifndef PATIENT_H
#define PATIENT_H

#include <iostream>
#include <string>

using namespace std;

class Patient
{
public:
Patient();
Patient(string fName, string lName, string idString, int bYear);

string getName() const;
int getAge() const;
string getID() const; int bYear() const;

void setFirstName (string fname); Use const reference to avoid the overhead of passing a whole
string structure:
void setFirstName(co nst string& first_name);
void setLastName (string lname); See above.
void setID(string idString); See above.
void setBirthYear(in t bYear);
private: My preference is to include some whitespace between
the public, private and protected sections.
string firstName;
string lastName;
string ID;
int birthYear; You _may_ want this as an unsigned signed int since
people can't be born in a negative year.
};
#endif

HEADER DEFINITIONS
#include <iostream>
#include <string>
#include "patient.h"

using namespace std;

Patient::Pati ent() {
setFirstName("F irst");
setLastName("La st");
setID("Z9999");
setBirthYear(99 99);
} You may want to leave the fields empty for the default constructor.

Patient::Pati ent(string fName, string lName, string idString, int bYear) {
setFirstName(fN ame);
setLastName(lNa me);
setID(idString) ;
setBirthYear(bY ear);
} Prefer to use initialization lists:
Patient::Patien t(const string& fName,
const string& lName,
const string& idString,
unsigned int bYear)
/* here is the initialization list */
: firstName(fname ),
lastName(lname) ,
ID(idString),
birthYear(bYear )
{
}

If initialization is more complicated, then use an
initialization method and have each constructor call
it.

string Patient::getNam e() const {
return lastName + ", " + firstName;
} You may want to change the title of this method.
Some users may want to have both last name first
and first then last layouts.

int Patient::getAge () const {
return birthYear;
}
string Patient::getID( ) const {
return ID;
}
void Patient::setFir stName(string fName) {
firstName = fName;
}
void Patient::setLas tName(string lName) {
lastName = lName;
}
void Patient::setID( string idString) {
int i = idString.size() ;
if (i == 5) { Where did this magic number come from?
ID = idString;
}
else {
cerr <<"\nIllegal Patient ID: " <<idString<<" using Z9999"<<endl; Explain to the user why the ID is illegal:
cerr << "Patient ID string too long.".
Although you may want to through an exception because
this method assumes that cerr will be available and
the user will be looking at it. With an exception,
the function using Patient::setID will get to choose
what to do with this error.

ID = "Z9999";
}
}
void Patient::setBir thYear(int Year) {
if ((Year >1873) && (Year < 2003)) {
birthYear = 2003 - Year;
}
else {
cerr<<"\nIllega l Year: "<<Year<<" using 9999"<<endl;
birthYear = 9999;
}
} Why bother altering the year. There is nothing to
gain, but much more to lose. Just check for boundary
conditions and throw an exception. An integer, signed
or unsigned, has enough capacity for a persons birth
year.


**** Problem Driver *********** Hmmm, does the driver have a problem? :-)

#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include "patient.h"

using namespace std;

char resp;
void GetList();
bool getPatient(ifst ream &fin, Patient &P);
const int MaxPatientSize = 1000;

int main()
{

Patient P[MaxPatientSize];
GetList();

do{
cout <<"\nWould you like to read another Patient File? (y or n):";
cin >> resp;
}while ((resp != 'y') && (resp != 'Y') && (resp != 'n') && (resp !=

'N')); Do yourself a favor and research the std::toupper and std::tolower
methods. This will simplify to:
cin >> resp;
resp = std::toupper(re sp);
} while (resp != 'Y' && resp != 'N');


if ((resp == 'y') || (resp == 'Y')) if (resp == 'Y') /* see std::toupper */

GetList();
else
cout <<"Good Bye!"<< endl;

return 0; See EXIT_SUCCESS in <cstdlib>
return EXIT_SUCCESS;

}
void GetList()
{
cout<<"Enter name of Patient List to be read: ";
cin.getline( This line is an error. The compiler should have said something.

ifstream fin(file_name.c _str());
if (!fin)
{
cerr<<"\nCannot open Patient List. Good Bye\n";
exit(1); See EXIT_FAILURE in <cstdlib>
exit(EXIT_FAILU RE);
This is bad karma to have a function terminate the program.
The function should throw an exception or return a status.
Let the main() function be the only function that terminates
the program.

}
do
{
cout<<"Would you like to display your Patient List? (y or n): ";
cin >> resp;
}while ((resp != 'y') && (resp != 'Y') && (resp != 'n') && (resp !=
'N'));
if ((resp == 'y') || (resp == 'Y')) std::toupper or std::tolower. 'Nuff said.

{
for (P = Patient(),
while(getPatien t(fin, P)) What language is this?
1. Don't mix while and for loops.
2. A "for" loop implies one or more iterations.
3. A "while" loop implies zero or more iterations.
More bad karma.

{
cout<<"\n\n\n"< <setw(25) <<setiosflags(i os::left)<<"Pat ient Name"
<<setw(20)
<<setiosflags(i os::left)<<"Pat ient ID" <<setw(15)
<<setiosflags(i os::left)<<"Pat ient Age"<<endl;
cout <<setw(25)<<set iosflags(ios::l eft)<<P.getName () <<setw(20)
<<setiosflags(i os::left)<<P.ge tID() <<setw(15)
<<setiosflags(i os::left)<<P.ge tAge()<<"\n\n"; Looks like your Patient class would really benefit by overloading
operator <<. This would simplify to:
cout << P;

fin.close(); So, why is the file closed after reading one patient?

P = Patient(); This isn't necessary. No reason to clear an object when
it will be overwritten; just a waste of time and energy.
Poor karma.

}
else
return;
} bool getPatient(ifst ream &fin, Patient &P)
{ Note: This function could be replaced by overloading
the operator>> in the Patient class.
bool isOK = true;
string name = "";

if (getline(fin, name, '\n') && isOK) The first line does not need to check the isOK
variable.
Beware of using cut and paste.
fam.setFirstNam e(name);
else
isOK = false;

if (getline(fin, name, '\n') && isOK)
fam.setLastName (name);
else
isOK = false;

if (getline(fin, name, '\n') && isOK)
fam.setID(name) ;
else
isOK = false;

/*f (getline(fin, name, '\n') && isOK)
fam.setBirthYea r(name);
else
isOK = false; */

return isOK;
}

My suggestion is to implement two methods in your
Patient class that load and store to a string.

For example, your above input function will fail
if the data fields are all on one line separated
by tabs or commas. You will need another method
when retrieving the data from a database or
other input source.

My experience is to:
1. Input the data to a string.
2. Have the object initialize its members from
the given string.

In your program, the above simplifies to:
std::string text_line;
std::string patient_record;
std::vector<Pat ient> patient_list;
while (fin)
{
for (unsigned int i = 0;
(i < LINES_PER_RECOR D) && (getline(fin, text_line);
++i;
{
if (i > 0)
{
patient_record += '\t';
}
patient_record += text_line;
}
if (i < LINES_PER_RECOR D)
{
// Handle case of not enough data.
}
else
{
Patient new_patient;
new_patient.loa d_from(text_lin e);
patient_list.pu sh_back(new_pat ient);
}
}


Of course your right, sorry.

Well, I'm receiveing "unresolved external links" to the header
getAge, getID, getName.

But , I guess I'm looking for direction in the following, regarding the
executable file:
can I declare an array while initializing an object; ex: Patient
P[MaxSize], where MaxSize has been declared.(my goal being to limit the
number of Patient files (think hospital beds) to MaxSize
have I chosen appropriate parameters for the function getList in the
executable file

Thanks


You also have to make sure that your linker is fed all object
modules or your project includes all your source files.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.l earn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
10045
by: Gaurav Veda | last post by:
Hi ! I am a poor mortal who has become terrified of Python. It seems to have thrown all the OO concepts out of the window. Penniless, I ask a basic question : What is the difference between a class and a function in Python ??? Consider the following code fragments : # Fragment 1 begins a = 1
16
2624
by: Kirk Bevins | last post by:
Hello, new to posting, got a dilema in c++. I cant seem to create new instances of my student class. The idea is to make a database where the user inputs surnames and library card numbers etc. The piece of code I cant get to compile is: ......void main() { for (int i=0; i<10; i++) { student s;
6
1420
by: John Lee | last post by:
Hi, I was trying to find an elegant way of implementing/modelling the following scenario: student, borrower, reference and cosigner are all human beings - we would think to create a person base class and then create one class for each of the person type inheriting from person class - student is "IS-A" person, ... but there is chances that the student and the borrower will be the same person, how could we implement this in C#?
11
2155
by: wfhsiao | last post by:
Hello, while refreshing my understanding of C++, I found the overloaded operators could not work properly. Why my following codes keep printing the student b's data as a person's? Did I lost anything? Thanks for your help! person a("John", 30); student b("Mary", 20, "93406001"); person *p = {&a, &b};
12
3655
by: yahshuazane | last post by:
I am working on access database and need to give each student position based on their score in class. For example: A class with 5 students with the following scores: Student Score Student A: 32 Student B: 78 Student C: 90 Student D: 90 Student E: 21
11
4064
by: xxbabysue123xx | last post by:
Heres the problem: Create a class Student with instance data name, studentNumber, class (where class is a String containing one of the following: “Freshman”, “Sophomore”, “Junior”, “Senior”. Make the class implement the Comparable interface. Include a toString method. Write a driver program to demonstrate your work. Instantiate several objects of the Student class. Call your methods several times to show that class is ordered. ...
13
3795
by: Eric IsWhoIAm | last post by:
I have four tables created so far: Courses, Instructors, Courses and Instructors (which shows the Course and Instructor Name fields, but holds their IDs since those are the keys), and Students. Now, I wish to create a Classrooms (or something similar) table which will allow me to pick the Course from Courses and Instructors, and hold multiple Students for each Course. I am unsure how to do this in Access. Each student can have multiple...
9
2554
by: pnayak | last post by:
Hi, I am trying to write an intrusive List template class that accepts any type that is derived from a class called Link. I've derived a class called Student from Link to experiment. When I use the Link and Student class without List they work very well but when I used them through the List class the new operator doesn't throw but seems to be return 0. I've pasted the full code here and the program output. The commented part of main...
25
2853
by: doznot | last post by:
Let's say you want to use Moodle to teach an introductory class in PHP programming. Some of the students have little or no computer experience. In addition to background reading and topics-oriented assignments supplied by Moodle, you want to build an online text editor into the course, so students can type their PHP programs and HTML directly into files on the server, so they don't have to fight with NotePad on Windows PCs in a lab, and...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10393
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4334
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.