No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
I have been told it is good to overload the stream extraction operator to load data from a file. Would I simple use this in my class: friend ifstream &operator>>( ifstream &input, Class &C ) { input >> C.variable1 >> C.variable2 >> C.variable3; return input; } What are the advantages … |
|
I would like to convert a procedural database program that I have created to an object oriented program. In my procedural program I use a struct: struct shoes{ char Name[20]; int Number; double ShoeSize; }; Putting this into a class would I simply use: class Shoes{ public: //Function declerations private: … |
|
I have created a basic object oriented database of a list of shoes containing the shoe name, number and shoe size. I am trying to sort the list of shoes alphabetially by name and by shoe size. I have the following code: Shoes.h: #include <iostream> #include <fstream> #include <string> #ifndef … |
|
How would I pass an element in a struct array. I have to call the function: new(Shoe[num], num); where num is the number of elements in the database. I have declared the function as: void new(Shoes Shoe[], num); but I get the error: cannot convert 'Shoes' to '*Shoes' for argument … |
|
**What I would like to do:** - Read data from text file - Display data from text file - Add new data to text file - Save new data to text file **The file format used is as follows:** Number of items in text file (3) Name 1 Number 1 … |
|
I have to create a database with the data stored in a .txt file. Each record is for a company with the following fields: Name, Place, East(km), North(km). Each record from the file needs to be read into a struct array. I have managed to read the records into a … |
|
I have to create a database with the data stored in a .txt file. Each record is for a company with the following fields: Name, Place, East(km), North(km). Each record from the file needs to be read into a struct array. I have managed to read the records into a … |