»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 01-03-2004, 11:15 AM   #1 (permalink)
Registered User
 
thekemp's Avatar
 
Join Date: Nov 2001
Location: manchester uk
Posts: 908
thekemp is on a distinguished road
c++ question

hi , im new to c++ and we are building a word game for our first project, the thing i need help on is that i have to include a text file of words for a player to guess words by adding vowels and consanents, but i cant figure how to include this into the code. its about 2500 words so would i need to use 1. an array or 2. hash tables?

thanks for any input!

regards

thekemp is offline   Reply With Quote
Old 01-04-2004, 06:00 PM   #2 (permalink)
Registered User
 
FalcomPSX's Avatar
 
Join Date: Oct 2001
Location: SoCal.
Posts: 1,856
FalcomPSX is on a distinguished road
Send a message via ICQ to FalcomPSX Send a message via AIM to FalcomPSX
do you already have the file of words? what's the format of that file?
__________________
- FalcomPSX
FalcomPSX is offline   Reply With Quote
Old 01-04-2004, 06:04 PM   #3 (permalink)
Registered User
 
thekemp's Avatar
 
Join Date: Nov 2001
Location: manchester uk
Posts: 908
thekemp is on a distinguished road
yes the file is pre-writen by the teacher and it is a txt file, the other thing is the program is writen in visual c++ with an mfc .
thanks for any help
thekemp is offline   Reply With Quote
Old 01-04-2004, 06:12 PM   #4 (permalink)
Registered User
 
FalcomPSX's Avatar
 
Join Date: Oct 2001
Location: SoCal.
Posts: 1,856
FalcomPSX is on a distinguished road
Send a message via ICQ to FalcomPSX Send a message via AIM to FalcomPSX
have they tought you how to use iostream yet?
__________________
- FalcomPSX
FalcomPSX is offline   Reply With Quote
Old 01-04-2004, 06:21 PM   #5 (permalink)
Registered User
 
thekemp's Avatar
 
Join Date: Nov 2001
Location: manchester uk
Posts: 908
thekemp is on a distinguished road
this is the assignment:

player will be requseted to select vowels and consonants up to a maximum of 9 letters, and then the player will be given 30 seconds to devise a word with the most letters from those letters previously selected. a player will be given 5 games and there score will be summed to give an overall score .

the text file needs to be called in some way i was told hash tables or an array, but if your talking about iostream, then could i use an ifstream. my knowledge is limited on iostream

thanks again!
thekemp is offline   Reply With Quote
Old 01-04-2004, 06:21 PM   #6 (permalink)
Registered User
 
elmers's Avatar
 
Join Date: Sep 2003
Location: Euroland
Posts: 397
elmers is on a distinguished road
So do you need help with reading a txt file from a program or an efficient algorithm to find the longest word from you can make from the given letters in you dictionary?

Last edited by elmers; 01-04-2004 at 06:34 PM.
elmers is offline   Reply With Quote
Old 01-04-2004, 06:26 PM   #7 (permalink)
Registered User
 
thekemp's Avatar
 
Join Date: Nov 2001
Location: manchester uk
Posts: 908
thekemp is on a distinguished road
does this make any sense?
(vehicle is an example)

void CVehicleFileView::OnDraw(CDC*
pDC){
CVehicleFileDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);

ifstream vFile;
char vLine[100];
int yPos = 10;
vFile.open("vehicle.txt", ios::in);
if(!vFile)
return;
while(!vFile.eof()){
vFile.getline(vLine, 100); //read each line of text
pDC->TextOut(100, yPos, vLine);
yPos += 25;
}
vFile.close();
}
thekemp is offline   Reply With Quote
Old 01-06-2004, 07:17 PM   #8 (permalink)
Registered User
 
elmers's Avatar
 
Join Date: Sep 2003
Location: Euroland
Posts: 397
elmers is on a distinguished road
As far as I can tell your proggy reads a txt file and spits is out onto the screen one line per page. Also there are 80 chars in a line in standard text format.
elmers is offline   Reply With Quote
Old 01-07-2004, 06:23 AM   #9 (permalink)
Registered User
 
Join Date: Jan 2004
Posts: 1
SIBUK is on a distinguished road
thekemp, hello there you fellow Bolton Institute student you. I do not know what the chances of me finding this thread were but whoever you are I will see you on Thursday the 15th 9:00 am in Steve Martins c++ lecture muwahahahaaa

P.S. Did you do the Top 10 scores file? I am stuck on that.
SIBUK is offline   Reply With Quote
Old 01-18-2004, 01:07 PM   #10 (permalink)
Registered User
 
Join Date: Jan 2004
Posts: 4
Eyez is on a distinguished road
C++ Word game

Hi thekemp and sibuk,im also doin this word game but very bad with c++. Wondering if you guys can help me out.
Thanks.
P.s. I will return any favours done.
Eyez is offline   Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 04:56 PM.