Solved

reading stored float data from external external file in VC++?

Posted on 2002-04-15
2
183 Views
Last Modified: 2010-04-02
I have float data from an external file in this format:
0.1 0.4 0.6
0.3 0.5 0.7
0.2 0.9 0.3

The columns represent 'j' array and the rows represents the 'i' array.
I am using check boxes as my inputs in the form of varying combinations, where each combination represents a particular set of rows from the external float data.

e.g if my input combination is:
if(checkbox1==true&&checkbox2==true)
{
//go to select the first two rows from the file();
}
if(checkbox1==true&&checkbox3==true)
{
//go to select the first and third rows from the file();
}
e.t.c

could some one help me on how to implemant the function that searches or selects the corresponding rows representing the input combinations?

currently i am using a longer method, by reproducing the corresponding rows whenever a corresponding combination is satisfied.
 
need a shorter method

icemunn








0
Comment
Question by:icemunn
2 Comments
 
LVL 2

Accepted Solution

by:
LoungeLizard earned 100 total points
ID: 6943614
Without using arrays of some kind with the check boxes, I can’t see who you can do it other you are now. If you had an array of check boxes, you can do something like:

for(i = 0; i< CheckBoxCount; i++)
{
  if(checkbox[i]==true)
  {
    //get the row i
  }
}
0
 
LVL 2

Expert Comment

by:gandalf79
ID: 6943631
my suggestion would be to make a list of all rows you want to grab in the file(sorted would be best). then do a for loop until the end of file. and each time you come to a line in your list grab it.
here is the psudo code for this operation

make a list of lines to grab
sort list
for index = 0 to eof
   if line is in list
      advanc to next item in list
      grab line form file
do stuff with info from file
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question