I've attached an image that shows a basic table with dynamic content in the header.
Initially, I thought about using a datagrid. However, I can't use a datagrid because of the format of my data visually. The DataGrid would not allow me to have static and dynamic data inside my column headers.
You see anything I am displaying in brackets, {}, are being updated with results after I process some data in the backend. After the data analysis is done, the results are displayed based on an algorithm.
So, let's say for control1, for each family, it would indicate whether the data passed or failed. Then, in the rows themselves, it would update with choice 1 or choice 2 depending on the data generated.
So, the data that is in brackets shows properties being updated. I'm not sure what UserControl I can use to accommodate this kind of display.
This is the question; Write a function that builds a two-dimensional multiplication table with arbitrary sizes for the two dimensions.
This is what I have done. I have allowed the user to input whatever size table they want by arbitrarily choosing what value they can input. However I cannot get the board to have blank squares. I thought the char would do it.
Code: #include <iostream> using namespace std; char SQAURE_CHAR = {' '}; const int Board_Size = 14;
Data structure problem. I have a table of the following format:
Code: C/R 1 2 3 4 5 6 7 ... 1 x x x 2 x 3 x 4 x 5 x x x 6 ... s
So my column and row names are integer numbers if an outcome of some game for a certain column and row lable is a match then we have an x on that position. The size of the integer names for both column and row name is quite large (let us imagine that it is so large that you would need a machine with 500GB of RAM memory to hold this type of table even if x's are treated as regular char's) . In every row there is at least one x and for every column the same holds for the columns. However, the number of x's for a row or a column can be bigger then 1. How to store this table efficiently? (using as less memory as possible).
The data structure should be efficiently accessed in the column fashion that is, if i want to get all values for column 4 I should be able to do that in O(N) time where N= the number of rows.
After i set the value in the first structure owners name, i set the cats name equal to it. but when i change the value in the first structure it doesn't change the value in the second structure.
So i need the dogs owners name to be equal to the cats owners name
So if i change the value of the dogs owner it also changes the value of the cats owner.
I have started working with structures so here's a side project from my text book. It's purpose is fairly simple; it asks for the sales of each quarter of the year from 4 different divisions and then calculates the average quarterly sales and total annual sales and finally displays all the data. My problem is that in the function "displayCompanyInfo" the statement
std::cout << "Division " << R.division_name << std::endl; does not display the name of the division. With that in mind here is the code: #include <iostream> #include <string> struct CompanyInfo {
[Code]....
As you can see the last part of the output has statements that say "Division" however they do not say the name of the division afterwards. I don't understand why that is?
i can't implement trie with dynamic array .the problem is in this line i think :
Code:
childs_size = (node_p -> childs_value_p)[0] + 1; here is my code : Code: #include <stdio.h> #include <stdlib.h> #include <string.h> struct trie_node { unsigned char *childs_value_p; // pointer to an array of child nodes value struct trie_node **childs_ptp; // pointer to an array of child nodes pointer struct trie_node *failure_node_p; // pointer to failure node
[code]...
i could write this code with binary tree instead of dynamic array but need a large amount of memory for about 13000000 strings of length 16 . is there any better solution with lower memory usage to implement trie ?
template <typename T> struct avl_tree { T data; int balance; struct avl_tree <T> *Link[2]; static int (*comp)(T, T); };
In main, I have a function like so: int compare(int a, int b) { return ( a - b ); }
Now how do I assign the function pointer in my avl_tree class to the compare function?
I did this: int (avl_tree<int>::*comp)(int, int) = compare;
But I got the compiler error: Tree_Test.cc: In function ‘int main()’: Tree_Test.cc:27:42: error: cannot convert ‘int (*)(int, int)’ to ‘int (avl_tree<int>::*)(int, int)’ in initialization
I created a class (let call it X) which contains the structure to store the data from my data base. Them I have a class (call Y) which will contain a list for each row in my data base. Third, I have a class with thousands variables (Z). What I am trying to do is to take the list of objects (Y) that contains the data to initialize Z. What I want to now if I can do something like that.
Imaging that one of my rows contain the following data: Type Nameofvariable etc... "static const double; MNFAIL ; 0; 0; 0,25"
In my list I have a node with contain this data
I want to use the field Nameofvariable to initialize the variable called MNFAIL contained in my class Z.
Code: typedef struct _a { int id; } a; typedef struct _b { a my_a; my_a.id = 1; // error: expected specifier-qualifier-list before "my_a" } b;
I get error: expected specifier-qualifier-list before "my_a"
I must set the id for the kind of struct created inside the struct def because main() will be casting based on this id. Thats how I will know which structure b contains by it's id, there could be hundards of different structs with different values I will cast to the correct one and know it's members by it's id. How do I ?
This works if the function pointer being passed to the event manager is not a member function.
I have two other classes Scene and Object that could potentially use this EventManager to create callback events. Scene and Object are both pure virtual objects. How can I pass a pointer to a member function of the child classes of both Scene and Object? I am fine with just having two separate watchEvent functions for Scene and Object but how do I pass the type of the Object or the type of the Scene? The child classes are unknown as they are being created by someone using this game engine.
For example, if I want to make a player object it would be something like
class PlayerObject : public Object{...};
Now that PlayerObject type has to find its way to PlayerObject::functionToCall(). I think I need templates to do this but, since I never used them before
This is how I intend to use this
class OtherScene : public Scene{ void p_pressed(void){ //pause }
I have a question regarding composition and accessing members "deep" inside the composed structure. For example;
class A { private: int m_myInt; public: int myInt() const {return this->m_myInt;}; void myInt(int newInt) {this->m_myInt = newInt;};
[Code] ....
Now, from somwhere I have access to an object of type B where I want to update the A::m_myInt. How would you do this without "breaking" the whole purpose of private/public members?
B myB; myB.m_a.myInt(3); // Not allowed, and not desireable
I thought about implementing access through functons kind of like;
A & B::a() {return this->m_a;}; myB.a().myInt(3);
but I'm worried that this exposes my B::m_a-object too much. This would allow
myB.a() = A(); , right?
The following is a more desireable way of acces, but doesn't work for updating;
A const & B::a() {return this->m_a;}; myB.a().myInt(3); //Disallowed? myInt(int) is non-const.
What about this? Is this a good way of doing it?
class A { private: int m_myInt; public: int myInt() const {return this->m_myInt;};
[Code] ....
I guess it works? It would lead to a lot of data shuffling in case of larger sub-components.I would really like to do the following without exposing my components so much:
I am having an issue with my sort function. This is one part of the Hash table program. The main issue is that I am trying to sort the pointer table after all of the values have been entered. The ptr_sort function is not a class function and so I am therefore unable to use the class variables psize and pTable. Is there another way I should be trying this? it is a Vector should I use the sort() function from the vector class in STL?
If a user enters a string of boolean algebra it will ouput the table.
I have input parsing, cycling through the combinations, and outputing working. However once i parse the input I am not sure what to do with it. I have thought of having it write the parsed input to a new file as a function and then use that function, but that seems bad.
How to dynamically create the function, how to implement it.
BTW This is a console function, if that changes anything.
1) Count the number of rows in the table booking that are open and where the booking.postcode is "MK",
2) Take a note of the plot (in booking.plot_id), and then update the table plot.jobs with the value count.
For example running the SQL query when booking table has the following rows:
Would see the following highlighted values in plot.jobs being updated to 1:
I managed to resolve it with this code so far (note I am using Connector/Net):
public void RefreshPlot(){ string query = "SELECT Count(*) AS count, plot_id FROM booking WHERE postcode='MK' AND status='open' GROUP BY plot_id"; var cmd = new MySqlCommand(query, _connection); var da = new MySqlDataAdapter(cmd); var dtCounts = new DataTable(); da.Fill(dtCounts);
[code]....
Currently, my code only checks for existing rows in the booking table and updates the plot table. However if the row gets deleted in the booking, then the changes are not reflected in the plot table.
Example: If we delete the row with plot.id=1 and plot.plot_id=4, then booking.plot_id should go back to being 0, if it was initially 1. At the moment, it doesn't. How would I update my SQL statement to better reflect this? In a sense, it should check for "non-existent" rows, i.e. the impact that the row plot.plot_id=4 & plot.id=1 has on booking.plot_id when deleted?
I have a C# .NET Application which get data from QuickBooks via the ODBC Driver and save the result to C# data table. So, I want to transfer this data table to a mysql table on my own server. That's the code I use:
using System.IO; using MySql.Data.MySqlClient; //Add mysql dll on the .NET Tab in Project's references string connStr = "DSN=QBTest;"; string myServerAddress = "192.168.0.243"; string myDataBase = "CostTest";
I'm writing a program in which I have to use a matrix to represent a file in code. because it's a file, the size of the matrix is undefined, and therefore the matrix has to be dynamic. I found out that my compiler doesn't like dynamic multidimensional arrays, so I was thinking of this matrix as a dynamic (monodimensional) array of other dynamic (monodimensional) arrays. My program (and thus this example) uses unsigned chars.
i'm implementing a playerclass for a game.. in the game there are multiple player types, weapons ect.. i just wanted to turn my players weapons into a dynamically allocated c_str. once i added my: Destructor, Copy Constructor and Overloaded Assignment Operator. My initial values became corrupted and i cannot fix them.