Hello to all, I am new to C++ and having difficulty getting my code to execute properly. I cannot understand how to properly write the code to initialize variables in my Process function. The information for the relays and call length should be coming from my external data file (located in the same directory as my source file). Any advice at all will be appreciated.
The information for the relays and call length should be coming from my external data file
No. Not for the void Process(call_record &);. That function receives a reference to a call_record object. The necessary info should be in that object and the results apparently should be stored into the same object.
On lines 27-29 you do write to a call_record object and on lines 41-47 you do read from such object. Your Process() should read and write too (but with = rather than << and >> ).
I addition to keskiverto's comments The "call_record" class is wrong, kind of backwards. By defining all your variables as "public" it defeets the purpose of using a class. These variables should be "private" and create member functions or chnge the functions you have to be member functions. As you have it a "struct" would contain all these variables under one name.
In main the while loop checks for "eof". Not the best way to use a while loop. By the time the loop reaches the "eof" the last record will process twice. Have a look at this recent post. http://www.cplusplus.com/forum/beginner/222607/#msg1020980
For the if statement I would add some type of a short pause followed by "exit(1);" because there is no reason to continue with the program is the file does not open. You could loose the else and {} for the block. You really do not need an if/else statement because if true you will exit the program otherwise it is OK to continue with the program.