|
-
April 10th, 2008, 05:08 PM
#8
Re: Confusion++
 Originally Posted by GCDEF
Honestly, I don't think it makes much difference. The drawback with getting the algorithm done first is he has to have a mechanism for testing it with dummy data which will eventually just get thrown away. The requirements are that he read from a file, so getting that requirement done first will provide him with the data he needs to feed his algorithms.
At this stage, it's all new to him. While dummying up some data may be trivial to an experienced coder, seems like it's just one more thing for a novice to have to worry about.
Either way, the point is not to be overwhelmed by a big project, but to learn how to take what appears to be a large task and break it into its component pieces and solve them one at a time.
Just use
Code:
ifstream infile ("Filename");
string name[10];
int marks[10],i;
if (! infile.is_open())
{
perror("Error opening file");
}
i=0;
while (!infile.eof())// Read the file and parse it
{
infile>>name[i]>>marks[i];
i++;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|