| | |
help with files
![]() |
hello,, my first post here..
im a 1st year CS student..
i need a help on having the idea of how to make this assignment..
i need to make a program,,a question bank,, with this functions:
1. Add a question
2. Delete question(s)
3. Modify a question
4. Display question(s)
a. All questions
b. Questions by subject
c. Questions by subject-level (category)
5. Search for a question by keyword (displays questions that have the keyword found in the question or answer)
(THERE ARE 7 SUBJECTS ad 5 LEVELS,, so 35 CATEGORIES all in all)
The questions database must be persistent across usage sessions. That is to say, changes made to the Bank will have to be retained once the program is closed and then re-opened. To make this possible, the filesystem is used to store the questions for the quiz game. Load it once at startup, then save before quitting. Also, the Bank must be able to store an unlimited number of questions.
is it wise to use vectors here, then store them to files? if so,, how?
i think its easier to manipulate many textfiles,, instead of one,, maybe 1 textfile per subject..
i'm not that good in file processing and manipulations(like my english!).. so i really need help how to do this one... even without codes,, just specific ideas and algorithms.... thX..
im a 1st year CS student..
i need a help on having the idea of how to make this assignment..
i need to make a program,,a question bank,, with this functions:
1. Add a question
2. Delete question(s)
3. Modify a question
4. Display question(s)
a. All questions
b. Questions by subject
c. Questions by subject-level (category)
5. Search for a question by keyword (displays questions that have the keyword found in the question or answer)
(THERE ARE 7 SUBJECTS ad 5 LEVELS,, so 35 CATEGORIES all in all)
The questions database must be persistent across usage sessions. That is to say, changes made to the Bank will have to be retained once the program is closed and then re-opened. To make this possible, the filesystem is used to store the questions for the quiz game. Load it once at startup, then save before quitting. Also, the Bank must be able to store an unlimited number of questions.
is it wise to use vectors here, then store them to files? if so,, how?
i think its easier to manipulate many textfiles,, instead of one,, maybe 1 textfile per subject..
i'm not that good in file processing and manipulations(like my english!).. so i really need help how to do this one... even without codes,, just specific ideas and algorithms.... thX..
Last edited by azwraith69; Jan 7th, 2009 at 3:17 am. Reason: just to erase something
Read all of the questions into a vector, which is simple enough just takes one loop. Then you can append to the vector and you can remove items from the vector. Then before quitting besure to clear the text file and re-write everything stored in your vector!
Chris
Chris
Knowledge is power -- But experience is everything
•
•
•
•
Read all of the questions into a vector, which is simple enough just takes one loop. Then you can append to the vector and you can remove items from the vector. Then before quitting besure to clear the text file and re-write everything stored in your vector!
Chris
read,,clear then rewrite...
hmm,,
i'll try that one..
any other ideas will still help,,
i'll try to post my codes later...
thX!!
I am living in a mere program...
>>any other ideas will still help
Freaky's solution looks like a sure winner to me
The only problem I see is if you unplug your computer before properly shutting down the program so the data can be saved.
Freaky's solution looks like a sure winner to me
The only problem I see is if you unplug your computer before properly shutting down the program so the data can be saved. Last edited by Ancient Dragon; Jan 7th, 2009 at 10:23 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
haha.. thx again
but my problem now is the storing of individual questions to each element of vectors..
because most questions have '\n' inside them,,an example is a multiple choice-type question,, which make using delimiters quite hard..
my attempt would be to put a character (that i won't use in the question bank) at the start/end of every question to serve as a delimiter.. but is there any easier way? what specific functions can i use to read those questions and put into vectors easily?
thx..
but my problem now is the storing of individual questions to each element of vectors..
because most questions have '\n' inside them,,an example is a multiple choice-type question,, which make using delimiters quite hard..
my attempt would be to put a character (that i won't use in the question bank) at the start/end of every question to serve as a delimiter.. but is there any easier way? what specific functions can i use to read those questions and put into vectors easily?
thx..
I am living in a mere program...
![]() |
Similar Threads
- Forms in Random access files (Visual Basic 4 / 5 / 6)
- Use Backup to Restore Files and Folders on Your Computer in Windows XP (Windows tips 'n' tweaks)
- #include custom files (C++)
- putting password on files (Windows NT / 2000 / XP)
- how to open large files not supported by aol (Windows 95 / 98 / Me)
- Use Backup to Back Up Files and Folders on Your Computer in Windows XP (Windows tips 'n' tweaks)
- Access to 'Lost' files (Windows NT / 2000 / XP)
- can share files but no internet (Windows 95 / 98 / Me)
- problems wid cpp files (C++)
- FTP files (Geeks' Lounge)
Other Threads in the C++ Forum
- Previous Thread: What do you think?
- Next Thread: ACL TRUSTEE_TYPE is always Unknown.
| Thread Tools | Search this Thread |
api array based binary bitmap borland c++ c/c++ char class classes code coding compile connect console conversion count delete delete-line deploy desktop developer directshow dll download dynamic dynamiccharacterarray email embedded encryption error file forms fstream function functions game givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream information input int integer java lib linkedlist linker loop looping loops map math mathhomeworkhelp matrix memory multiple news node number numbertoword output parameter pointer problem program programming project python random read recursion reference reverse richedit rpg string strings temperature template templates test text text-file tree url variable vector video win32 windows winsock word wordfrequency wxwidgets






