?
Solved

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

Posted on 2002-04-15
2
Medium Priority
?
186 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
LoungeLizard earned 300 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
Suggested Courses
Course of the Month8 days, 7 hours left to enroll

766 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