|
Interesting, I thought it looked like a typo.
Learn something new every day.
-Nick Parker
|
|
|
|
|
I still don't quite understand why function "get();" doesn't need a return. Why is this?
Thanks, Dave
|
|
|
|
|
The get() function with no parameters reads and returns the next character from the stream. If this character is not required (eg. you simply need to skip to the next character) then there is no use for the return value.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I read that if a function did not return a value that (at a minimum) you had to use the "void" prototype...such as below:
void main( )
no?
hmmmmm
Dave
|
|
|
|
|
The get() function returns a value - the value of the next character read. This program simply doesn't use the returned value.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks Ryan
"The man who reads nothing is better educated than the man who reads nothing but
newspapers."- Thomas Jefferson
|
|
|
|
|
is there an implementation of btrees in STL?
|
|
|
|
|
Are you referring to a binary tree structure? If yes, STL containers including set and map are designed using binary stree structure.
Kuphryn
|
|
|
|
|
By btree, do you mean a binary tree, which can be lopsided, or a B-tree, which is always balanced?
|
|
|
|
|
a balanced tree that is.
however, any kind of a tree I guess wouldn't be bad. Anything like CTreeCtrl in MFC even?
|
|
|
|
|
B-tree, red/black tree, splay tree, and AVL tree are all examples of balanced trees, each with their own set of nuances.
The CTreeCtrl class is for displaying a hierarchical list of items, much like Windows Explorer.
|
|
|
|
|
B-Tree?[^]
Not that I know of, and I've been searching for it for quite a bit.
|
|
|
|
|
I want to be able to allow the user to modify the numbers in the array of the working program below. I want to enable the user to have the ability to delete, change or add a new number into the array. What would be my best approach to do this? Thanks much, Dave
-------------------------------------------------------------------
#include "iostream.h"
#include "string.h"
int main()
{
int x;
int i;
char str[80];
bool isfinished=false;
char Info [] [300] =
{
"6787-02-000-5287" , "Here is the information for this number." ,
"5978-03-000-0029" , "Here is the information for this number." ,
};
while(isfinished==false)
{
cout<<"\nPlease enter a number:\n";
cin>>str;
for(i=0; i < 4; i += 2)
if(!strcmp(str, Info[i]))
{
cout<<"\nInformation:"<<info[i+1]<<"\n";
break;=""
}=""
if(i="=" 4)=""
{=""
cout<<"number="" not="" found.\n";=""
cout<<"\nwould="" you="" like="" to="" check="" another?\n";=""
{=""
cout<<"enter="" 1="" for="" yes,="" 0="" no.\n";=""
(cin="">>x).get();
}
if (x==0) isfinished=true;
}
return 0;
}
|
|
|
|
|
One solution is and STL list container.
Kuphryn
|
|
|
|
|
It depends on what you are after. As I understand it, you'd want a simply menu like:
CHOICES
----------
1. Display
2. Delete
3. Change
4. Add
If the user chose #1, you'd print the current contents of the array using code similar to what you've shown.
If the user chose #2, you'd prompt for the array index to delete. All items in the array after that index would probably need to be moved "up" in the order to fill in the hole.
If the user chose #3, you'd again prompt for: 1) the array index, 2) the part number, and 3) the part number description. The array item at the specified index would then be updated with these new values.
If the user chose #4, you'd prompt for the part number and the part number description. These values would then be assigned to the next available index.
|
|
|
|
|
I'll read up some more on arrays and the STL list container and maybe something will start smokin' up in my attic.
Thanks, Dave
|
|
|
|
|
¿ANYONE?
[It is possible to represent everything in this universe by using 0 and 1]
I was born intelligent
Education ruined me!.
An idea is useless until it has been implemented.
|
|
|
|
|
What kind of settings?
Kuphryn
|
|
|
|
|
as i said in a dialog..
[It is possible to represent everything in this universe by using 0 and 1]
I was born intelligent
Education ruined me!.
An idea is useless until it has been implemented.
|
|
|
|
|
Your question was really quite open-ended, but I'll stir the tea leaves around and assume you are asking about saving the contents of various dialog box controls to a disk file that can later be opened to return that dialog box to it's saved state.
To do this, just create a data struct that has holders for all variables that are required to hold the dialog box data.
do a binary write of that data struct to disk.
Or create a class and serialize it to disk.
I'm going to live forever or die trying!
|
|
|
|
|
I've blown up this project 4 times by adding all sorts of ActiveX components that I thought would allow me to populate a combobox from a remote datasource but nothing worked.
I have currently kluged a solution that is so horrific I shudder whenever I see it.
My workaround is to create an InternetSession, send an HTTP request to a cold fusion page on my webserver that queries the database and the output is sent back to the buffer that is filled by the CHttpFile* read operation.
I then use character parsing to search for the field delimiters and move the parsed strings into the combobox.
UGLY!!!!!!!!!
For the ActiveX controls I dropped into the project I can't even get a compile. I see vague mention of my needing to create a wrapper class and yada yada.
Is there a prebuilt C++ class that I can just include in my project that will allow me to specify the IP address or name of my server, the ODBC DSN, the SQL query and the Combobox ID and have it populate it for me?
I have successfully added a great directory tree and the Victor Image Library into my project and it all works great, but I need to dynamically populate those comboboxes from a remote datasource.
PLEASE HELP!!!!!!!!
I'm going to live forever or die trying!
|
|
|
|
|
Does your database support ODBC?
|
|
|
|
|
The DB is already mapped as a system DSN on the webserver and is working fine with ODBC.
BTW - The server is running NT server 4
|
|
|
|
|
Then you should be able to create a DSN on your application's machine that "points to" the DB on the Web server. I did this once where a SQL database was on one machine and my client application and DSN were on another machine. Worked fine.
|
|
|
|
|
I had no idea that remote connections with ODBC were possible! I am OK with SQL the language, but very weak on the DB admin side and had no idea that you could map a remote DSN using ODBC administrator.
I went through all of the options in my ODBC administrator and nowhere does it ask me about the IP address for the remote server.
Is there a different ODBC admin tool I need to install first?
|
|
|
|