hi
I just want 2 know how you can display the first word from a list of words from a text file
you have to see that word then it dissapears and you have to type that word
than you go to the second word, it shows the word after 5 seconds or less it dissapears and you have to type that word..
at the end of the list should all the words that you have typed incorrect apear again

It's some kind of spelling checker

thx

Welcome to Daniweb and congratulations on your very first post :) Please go to Coffee House and post in Community Introductions to tell us a little about yourself.

To answer your question, start out by just writing a program that reads the words from a file. You can use <ifstream> std::ifstream and <string> std::string objects to read that in a loop. After you get that working then you can do another part of the assignment.

Post the code you have written and ask more questions if you need to.

#include <stdio.h>

void main(){
	FILE *fp;
	char naam[15];


	fp=fopen("naam.txt","r");

	fscanf(fp,"%s",naam);
	printf("%s\n",naam);
	fscanf(fp,"%s",naam);
	printf("%s\n",naam);

	fclose(fp);
	}

that's all I can figure out

The code you posted is C, not C++ and that's why I moved your thread to the C board.

Is the length of all the words in that file less than 14 characters? If not then you need to increase the buffer size on line 5.

lines 10 through 13 should be replaced by a while loop like this:

while( fscanf(fp,"%s", naam) )
{
    printf("%s\n", naam);
}

The code you posted is C, not C++ and that's why I moved your thread to the C board.

Is the length of all the words in that file less than 14 characters? If not then you need to increase the buffer size on line 5.

lines 10 through 13 should be replaced by a while loop like this:

while( fscanf(fp,"%s", naam) )
{
    printf("%s\n", naam);
}

Thx but the loop must stop after let us say reading 10 words out of 15 randomly
these words are in the text file and de size of the characters isn't large (small words)
How can is random display 10 words out of these 15 and do the spelling test?

If you think about it, it looks like hangman it reads a word from a text file randomly, but you don't have to guess the word, the word it being displayed for a few seconds and then you have to type it correcly. Some kind of word shooter..

read all the words into an array then you can easily choose random words.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.