how 2 go about is program

i cant undersatnd how 2 write dis program

Page 1 of 1

5 Replies - 732 Views - Last Post: 19 February 2008 - 03:23 PM Rate Topic: -----

#1 abhinavdagr8  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 19-February 08

how 2 go about is program

Posted 19 February 2008 - 04:28 AM

i want 2 make a c++ program which will
select 20 randon names from a txt file which will contain about 100 names
The 20 names will display for 1 min n den the user has 2 input as many names he can from the list by using his memory
and den the score regarding his correct no of words will display
can plz help me i cant think how 2 go about it

basicaly it is a memory game
Is This A Good Question/Topic? 0
  • +

Replies To: how 2 go about is program

#2 manzoor  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 13
  • View blog
  • Posts: 468
  • Joined: 07-August 07

Re: how 2 go about is program

Posted 19 February 2008 - 04:44 AM

SORRY

Mods sorry for this post wanted to post in another section.

This post has been edited by manzoor: 19 February 2008 - 04:46 AM

Was This Post Helpful? 0
  • +
  • -

#3 letthecolorsrumble  Icon User is offline

  • Student of The Sun
  • member icon

Reputation: 27
  • View blog
  • Posts: 555
  • Joined: 07-November 07

Re: how 2 go about is program

Posted 19 February 2008 - 04:59 AM

@abhinavdagr8

Please post anything you have done so far, because without your help first, we are helpless. :)
Was This Post Helpful? 0
  • +
  • -

#4 mac0sWizard  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 18-February 08

Re: how 2 go about is program

Posted 19 February 2008 - 06:13 AM

I agree with letthecolosrumble

post what you have!

this should take no more than 10 lines or so...
Was This Post Helpful? 0
  • +
  • -

#5 abhinavdagr8  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 19-February 08

Re: how 2 go about is program

Posted 19 February 2008 - 12:59 PM

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<fstream.h>

void main()
{ clrscr();
	char word[10];
	ifstream myfile("words.txt",ios::in);
	randomize();
	for(int j =0;j<4;j++)
	{	int n=random(30);
	for(int i=0;i<4;i++)
	{
	myfile>>word;
	if(i==n)
	cout<<word<<" ";
	}
	}
	getch();
}


Was This Post Helpful? 0
  • +
  • -

#6 letthecolorsrumble  Icon User is offline

  • Student of The Sun
  • member icon

Reputation: 27
  • View blog
  • Posts: 555
  • Joined: 07-November 07

Re: how 2 go about is program

Posted 19 February 2008 - 03:23 PM

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<fstream.h>

void main()
{	  clrscr();
	char word[10];										   //Use string if you know it
	ifstream myfile("words.txt",ios::in);
	randomize();		  //This function must be declared and defined outside main before it can be called
	
		for(int j =0;j<4;j++)
	{	int n=random(30);  
	for(int i=0;i<4;i++)
	{
	myfile>>word;		//if you are using array you would want to store data like this myfile>>word[i]
	if(i==n)
	cout<<word<<" ";
	}
	}
	getch();
}




Also please tell us where you are stuck, or what you can not understand.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1