Files into arrays

Pages: 12
Dec 1, 2018 at 6:01pm
closed account (SECMoG1T)
let me add some helper functions.
Dec 1, 2018 at 9:08pm
closed account (SECMoG1T)
hey i have tried clean things up a little ... no luck but i have remove the errors that were there earlier.

hope that helped, if you don't understand some ask.

https://pastebin.com/c5R6YVDn
Dec 1, 2018 at 9:58pm
Oh, Thank you very very very much,
words can not describe how thankful i am.

Also i need to do a delete function, i think the most suitable solution is to make a temp.txt file read everything except the item which is to be deleted then copy it back right? or is there a simpler way?

Thanks a lot again.
Dec 1, 2018 at 11:19pm
closed account (SECMoG1T)
that would be a very expensive operation, as you can see from my modified code on paste bin.

-the data is read into the arrays at the genesis of the program.
-any data added during runtime is stored into the array
-the data is saved into the file when the program is exiting.

so to delete an entry just search that entry, get the index and change everything to default values e.g name ="";///empty string id=0; phone=0; ticket_num=0;
the function i hvae written to save data will just skip any empty entries.

https://pastebin.com/ke5qEDFf


i have added a delete function, please debug any errors you find.
Dec 2, 2018 at 1:28pm
Yup it is working.
Thanks a million.
Dec 2, 2018 at 1:32pm
By the way what does the last function do exactly?
Dec 2, 2018 at 1:40pm
oh i get it now, it skips the empty entries.
THANKS!!.
Dec 2, 2018 at 1:55pm
By the way, if i have 50 tickets sold then if i delete one and then book another it says all the tickets are sold, any idea how to fix that? should i make conditions of count-- at the delete function everytime it deletes a ticket?
Dec 2, 2018 at 3:05pm
closed account (SECMoG1T)
hello i'll be changing a few things, post the final later.
Dec 2, 2018 at 6:49pm
Thank you so much,
i will be waiting.
Dec 2, 2018 at 7:57pm
closed account (SECMoG1T)
i have changed a few things, i have used an array that tracks the sold tickets instead of just storing ticket numbers, everything should work as expected now, i have also added some few function , deleted other and redefined them .

if you have a question ask?

https://pastebin.com/n3xNx2Xv


once you understand classes and struct the whole thing would be very simple.
Dec 2, 2018 at 8:06pm
Thank you very much for your help and patience.
well i think i will spend my vacation learning more about the language outside my course that would probably grant me more freedom, i also struggled a bit since this semester was short and everything happened so quickly.
Thank you very much again.
Dec 2, 2018 at 8:10pm
By the way at line 461 it gives me an error
std::string ticket_type{};
this is an array?
if yes what should be the range
Edit: i think it is just a normal string.
Last edited on Dec 2, 2018 at 8:32pm
Dec 2, 2018 at 8:38pm
closed account (SECMoG1T)
sorry change it to std::string ticket_type="";
no it is just a string variable.

if you have any other error ask.

edit: updated again, fixed main_menu()

https://pastebin.com/6SwCKcr8
Last edited on Dec 2, 2018 at 8:42pm
Dec 2, 2018 at 8:41pm
Nope other than that it is error free, thank you very much.
Dec 2, 2018 at 8:50pm
closed account (SECMoG1T)
yea there is an unimplemented function

main menu option " b. Cancel ticket reservation\n"\ isn't implemented, unless it means the same as option h
Last edited on Dec 2, 2018 at 8:54pm
Dec 2, 2018 at 9:03pm
Yup it is the same as option h.
Dec 2, 2018 at 9:16pm
closed account (SECMoG1T)
all errors fixed.


https://pastebin.com/Xrmc3iAc


remember to set your own file path on line 39
Last edited on Dec 2, 2018 at 9:19pm
Topic archived. No new replies allowed.
Pages: 12