I have two Tree views populated from XML files. I have them loaded side by side in a windows form. treeView1 and treeView2. I need to compare these two treeviews and highlight any difference in any of the nodes. I am using C#.NET Visual Studio 2012 professional.
Essentially I have an MDI that I want to be able to switch between having all my views tabbed when one is maximized and having all my views cascaded or tiled to their previous sizes. The MFC app wizard provides options for either tabbed or untabbed views.
How to implement this? What is the class that MFC uses to place each of the MDI child frames in tabs?
For my data-structures class, I am attempting to create a binary search tree template to be used to create an AVL tree. I've written a Generic_Tree template for the BST to inherit from, and before I jump into implementing the AVL tree I'm testing the BST member functions. Everything was compiling fine until I added the BST insert() function. Now, I'm getting the following error message from my linker:
undefined reference to 'BST<void>::insert(int, void*)'
Apart from compiling i am running a software to test for compliance with standards. I always get the following warnings.Implicit binary conversion from one (type) to (type). The type in general can be unsinged int, long etc. There are several cases in which this happens. Like in an if statements, i made sure that both the types are of the same type by type casting.Is it true that i cannot compare an 8 bit value with 16 bit value? I cannot compare a signed value with an unsigned value?what are the exact rules for this?
In an assignment operator i cannot assign a bigger value to the smaller value. Am i correct?Suppose if i multiply a varaible with constant then the constant should be type casted to the same value as the variable?Also if i am shifting a variable say test1 << 1. Then should 1 also need to be typecasted. How to handle situations if the variable is a complex structure or union? i am very much cofused not able to follow definite rules and mostly trying trial and error and i dont want to do that way.
In stl map, if I insert two keys, say a and b. It looks like compare operator is called twice. First time a<b is called and second time b<a is called. Why are both a<b and b<a called?
I am trying to figure out how to go about comparing two strings of numbers. I have two files that both contain numbers 1-50, one file has multiple repeating numbers while the other one just has 1-50.
I want to compare the files and count how many of each number a occurred and make a chart with * next to the number. First I figured I would use the strings like an array and compare them using nested loops. Then I noticed I have single and double digit numbers. The numbers in the files are printed as:
1 44 5 34 4 2 22 7 55 4 ...... etc
Compared too: 1 2 3 4 5 ...... 50
I thought about using string stream and converting the string to int but wouldn't it just be a huge number when set to the int variable? Then I thought about a array initialized with 1-50 and compared to the file but I still have the issue with single and double digit numbers.
My question is how can I just read one number at a time, either double or single digit?
I have an assignment in my OOP c++ class and I had to create a class called date and one of the member functions is a compare function that compares two dates that are taken in. It is suppose to be something like this:
Date d1(12,25,2003);// Dec 25, 2003 Date d2(5,18,2002);// May 18, 2002
d1.Compare(d2);// returns 1 (since d2 comes first) d2.Compare(d1);// returns -1 (calling object is d2, comes first)
Then if d1 and d2 are equal then it returns 0.
This is what he gave us to start with the function:
I have two char* that have the same data in (hypothetically).
std::vector<char*> Buff; Buff = Split(Line, '.'); char* A = "data", B; B = Buff.at(0)
Where Split is a function that I made to split a string (Line in this case) into a char* vector, this string contains a line from a file. Line is char* too. The weird problem is when Buff data stored in its 0 position is given to B... because B is equal to A (hypothetically) but when this is compared to do certain functions they doesn't match!
Here an example:
std::vector<char*> Buff; Buff = Split(Line, '.'); char* A = "map", B; B = Buff.at(0) // Buff.at(0) should be "map" and is apparently "map"
[Code].....
NOTE: I didn't use switch to compare Cmd because I want it separately for easier debugging.
Is there something wrong with my codes?? or what happened here with those hex values before the string in my variables?
I am tying to compare two histograms, but it gives error. Here I have given my code, histogram file and error message. Histogram file 3*5 matrix(output_test.txt):
1 2 3 4 5 5 2 1 4 2 2 1 2 4 2
code:
int main(..........) { ................................................ Mat first_histogram(1,feature_vector_size, CV_32F); Mat second_histogram(1,feature_vector_size, CV_32F); for(i=0;i<count_row;i++) { for(j=0;j<count_row;j++) {
I am currently taking a C# class. Our current assignment has us entering a player name, and number of hits and displaying these in one set of labels. I have coded everything for the primary function of this program and it works. However, I also have to have a second set of labels that show the highest number of hits entered (if I enter 44, the first and second labels change to 44; if I then enter 27, the first label changes to 27 and the second stays at 44; and if i enter 55, the first label changes to 55 and the second label changes to 55) and the corresponding player name. I have tried searching and reading and I can't seem to figure out how this is done.
I am trying to get a list of queries to work right now. I have it so that the user will input 1 of 5 things to compare twin primes in a list. I am just trying to get the queries working fully before actually determining the twin primes that need to be output. The console input will be something like "<= 61" and will display all twin primes from 3 to 61, inclusive.
Well, I thought I had it 100%... Then I realized I have a problem, though. So, I'm reading the string in until a space so I can read in the number after that. So that works fine, but then I also want the "all" and "random" console inputs to work, but they won't unless I put a space after them, which is what I'm trying to avoid...
So, I tried just simply asking for another console input after all of my if statements for the string compare after the first console input. That obviously doesn't work either, though, because it still only wants the first "getline" where it reads until the whitespace.
How to be able to do both on the same console input... The relevant code is posted below:
cout << endl << "What do you want to know about your list of twin primes?" << endl; string qprompt1; string qprompt2; getline(cin, qprompt1, ' '); string comp1 = ">"; string comp2 = ">=";
std::string str = "Hello"; std::string phrase = "Hello world"; std::string slang = "Hiya"; and i have these two rules to compare 2 strings object :
if two strings have different lenghts and if every character in the shorter string is equal to the corresponding character of the longer string, than the shorter string is less than the longer string.
if any characters at corresponding positions of two strings differ, then the result of the string comparison is the result of comparing the first character at wich the strings differ then my book says : if we apply the rules of the comparison we know that phrase is greater than str( ok i've understood this ) and that slang is greater than both slang and phrase ( why ?)
explain me rule number two ? in phrase and slang the characters differ and the first character that differ is not H so why my book says slang is bigger than phrase ?
"Write a program that compares the memory addresses of two different variables on the stack and prints out the order of the variables by numerical order of their addresses.
Does my solution look correct
Code: #include <iostream> using namespace std; int main() { int one = 1; int two = 2; if (&one < &two) cout << one << " " << &one << " " << two << &two << endl; else cout << two << " " << &two << " " << one << " " << &one << endl; }
I am trying to write a program that prints a 2d array to the screen and then compares each row and column to see if there is any pairs of letters. basically something that looks like this:
--------------------------- V T A Y U C B D F W Q Q C R D A L Y M F G O A S S D T I
Number of horizontal pairs: 2 Number of vertical pairs: 3 ---------------------------
so far this is my code below, but i dont know how to approach the comparisons
Code:
#include<stdio.h> #include<stdlib.h> #include<time.h> int main( void )
I have a dictionary which maps a Guid to Orders, it contains like 350000 orders
Code:
Dictionary<Guid, Order> htPreOrders = new Dictionary<Guid, PreOrder>(350000);
Im trying to optimize it by replacing the IEqualityComparer by a custom one.
Code:
class Comp : IEqualityComparer<Guid> { public bool Equals(Guid x, Guid y) { return x == y; } public int GetHashCode(Guid obj) { return obj.GetHashCode(); }
Dictionary<Guid, Order> htPreOrders = new Dictionary<Guid, PreOrder>(350000, new Comp()); would this be faster, or is that the same as the default equality compare of Guid?