|
Oh yeah, forgot to mention another idea. Create a Red / Black tree from the code. Look at examples for expanding lambda expressions.
|
|
|
|
|
I don't know about this either, so I'll try working with the hints and ideas from above and if it doesn't work out I'll research this and work on it
Thanks for your ideas
|
|
|
|
|
hope your problem is solved.
i did some paperwork onit yesterday and got some ideas.
do you require any more discussion on that today?
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Actually I was very busy yesterday, so I didn't have time to implement the ideas that I got from the discussion here yet but I'll start working on it today and let you know how it works out. Post your ideas anyway they might help me now I need all the help I can get
Thank you for taking the time to think about the problem
|
|
|
|
|
so, kindly confirm these points for me as per my understanding of the problem.
1. the coefficients may be 0 means, one of the variables may be absent in the expression.
2. the sequence of the variables may change.
3. Will a variable be only 1 character or may be more?
4. what will be the maximum n? (size of expression/number of expressions)
because,
the solution i have sketched are dependant onthese inputs.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
1. Yes, that's possible, but a friend gave an idea of initializing the whole 2d array to equal zero, so when a variable isn't found in an equation the value isn't changed and would be correct for further calculations.
2. Yes, the sequence may change from one equation to another.
3. Variables could be one or more character so I'll just save them in an array of strings.
4. No maximum size was stated, but I don't think that matters as long as the arrays are dynamic, or does it??
|
|
|
|
|
yes,
my ideas seem to resemble with those you got yourself or my be from our friends here.
go ahead, and you will surely achieve it.
we will also co operate withyou.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Working on it now ....
|
|
|
|
|
Omar Al Qady wrote: If anyone has any ideas I'd really appreciate it
Here's a half-baked one:
void main( void )
{
char szTemp[16],
*pInput[3] = { "3x+2y-2.5z=9",
"-2x+9y+12z=23.4",
"4.2x-7y+9.6z=45.3" };
int x = 0;
double d1, d2, d3;
for (char *p = pInput[0]; p && *p != '\0'; p++)
{
if (isalpha(*p))
{
szTemp[x] = '\0';
x = 0;
}
else if ('=' == *p)
break;
else
{
szTemp[x] = *p;
x++;
}
}
}
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Good ideas, I'll try to incorporate them into my solution
Thanks
|
|
|
|
|
hi,
i want to know that how to read a file line by line using Readfile() function ??
also please tell me how to get the address of a text file which is in the same folder as the program ? i want to open it in the program, but the folder location may change.
thanks
rahul
|
|
|
|
|
rahuljin wrote: also please tell me how to get the address of a text file which is in the same folder as the program ? i want to open it in the program, but the folder location may change
in most of the cases, though the folder location changes, the files available inthe folder same as the exe can be accessed direcly by its name. i mean no path need to be specified.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Opening a File for Reading or Writing[^]
The folders in the working directory is always accessible by it's name. Only few APIs insist to give the entire path of the file name. In such cases, You can call GetCurrentDirectory API to get the current directory path and append the file name with _T( "\\" ) (C++ notification for '\') using any of the string concatenating function.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
rahuljin wrote: i want to know that how to read a file line by line using Readfile() function ??
If you are using MFC, then you could use CStdioFile[^], which exists for this purpose.
What do you mean by "address of a text file"? You mean the path? In that case, like another poster pointed out, you need not specify a fully qualified path. Just the name of the file will do, if the file is present in the same directory as the program.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: Just the name of the file will do, if the file is present in the same directory as the program.
but i have a doubt here, can u please clarify,
in one of my apps even i assumed so,
but in the same app, if i used CFileDialog, after user selects an input file from any other folder, from tha point onwards, specifying only the file name, will give an error coz, the newly selected folder need not have that file.
in this case ihad to use Getcurdirectory api.
is there any other way we can reset it back?
thank you.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
CFileDialog ?! So, you're using MFC. Then you must use CStdioFile class to read file (you said line by line) instead of ReadFile() and that will make things simpler for you.
chandu004 wrote: if i used CFileDialog, after user selects an input file from any other folder, from tha point onwards, specifying only the file name, will give an error coz, the newly selected folder need not have that file.
in this case ihad to use Getcurdirectory api.
CFileDialog::GetPathName()[^] returns the full path of the file selected by the user (of course, if clicked OK).
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: CFileDialog?! So, you're using MFC. Then you must use CStdioFile class to read file (you said line by line) instead of ReadFile() and that will make things simpler for you
no no,
i was not the one who posted the thread and asked the question of reading line be line.
my question is, normally, without specifying the path, the files in the curdir can be accessed by default.
but in the same app, if we had used CFileDialog::DoModal(); after that, the above condition would not be applicable.
i wanted to understand from you, if there is any way to overcome this.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
chandu004 wrote: i was not the one who posted the thread and asked the question of reading line be line.
Sorry about the confusion. Clearly, I need some rest.
Like I said, you can retrieve the full path of the file selected by the user by calling CFileDialog::GetPathName() if the user clicked OK. Something like this:
CFileDialog cfd(true);
if(cfd.DoModal() == IDOK)
{
CString szSelectedFile = cfd.GetPathName();
}
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi Rajesh,
If Possible please try to help me regading the thread increase the DialogBox size during Runtime which was posted by me....
|
|
|
|
|
Rajesh R Subramanian wrote: Like I said, you can retrieve the full path of the file selected by the user by calling CFileDialog::GetPathName() if the user clicked OK.
iam aware of these operations sir, i think iam unable to put my qn into proper words. now i think i also need some rest.
any way here is my last attempt to explain my doubt.
1.in some of my screens/modules, i used file operations simply by using the filename with out path.
assume my application and the files are in "E:\\project" folder.
2.these modules were working perfectly.
3.say there is one more module in the same application, where, user has to browse for a file and he selects a file from desktop(obviously he clicks ok). now, the application will read some data from the selected file and do some thing else.
4.from this point onwards, the modules as discussed in point no 1 shows abnormalities coz, the default filenames are not available on desktop.
i mean, default folder is reset from the application folder to desktop.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Why does changing one thing affects the other?! Sounds like a design issue to me.
If you are dealing with say 3 different files, you can have string member variables in your class that will hold the path of each file used and initialize them once (and update them if the user browses for a different file)?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: If you are dealing with say 3 different files
not 3 files. the file count is variable and dynamic.
any way, take it easy.
thank you.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
You mean there are different files, can be on any location and must be kept track of by your application? You could use an array of strings as a data member in your class? If you could explain your scenario more appropriately and explain your current approach, people over here can propose something better. Perhaps you should start a new thread.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
actually this problem i faced in a projhect i executed ~2 yrs ago.
i solved it by some other techniques, like using some function which gets the application path.
i posted my query to enquire if there was any other straight forward method.
any way leave it my friend, iam still failing to explain my problem correctly.
i feel we are getting carried away.
thank you once again.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Hi,
There is a flag for CFileDialog, named OFN_NOCHANGEDIR to keep current directory unchanged after file selection. It is used to form dwFlags which is 4th parameter of CFileDialog constructor. It can be used with flags member of OPENFILENAME structure for Win32 API, of course.
However, you might also keep track of current directory by yourself using GetCurrentDirectory() and SetCurrentDirectory() functions.
|
|
|
|