Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

sadas232341s

@sadas232341s
About
Posts
45
Topics
19
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to find the most frequent value of string array, and how many
    S sadas232341s

    Here is my code, but it shows "asd 2" instead of "qwe 3". Why is that?

    #include
    #include
    #include
    #include

    using namespace std;

    int main()
    {
    string str[8] = {"zxc", "zxc", "asd", "qwe", "qwe", "asd", "qwe", "jkl"};
    vector v_str;
    string t_str, maxstring;
    int maxrep = 1;
    int currep = 1;

    for(int i = 0; i < 8; i++)
    	v\_str.push\_back(str\[i\]);
    
    sort(v\_str.begin(), v\_str.end());
    
    t\_str = v\_str\[0\];
    maxstring = t\_str;
    
    for(int i = 1; i < v\_str.size(); i++)
    {
    	if(t\_str == v\_str\[i\])
    		currep++;
    	else
    	{
    		if(currep > maxrep)
    		{
    			maxrep = currep;
    			maxstring = t\_str;
    		}
    
    		t\_str = v\_str\[i\];
    		currep = 0;
    	}
    }
    
    for(int i = 0; i < v\_str.size(); i++)
    	cout << v\_str\[i\] << endl;
    
    cout << endl;
    cout << maxstring << " " << maxrep << endl;
    
    return 0;
    

    }

    C / C++ / MFC graphics data-structures tutorial question

  • menubar icons (win32)
    S sadas232341s

    how to easily put icons in the menubar here in the image below? http://forums.bgdev.org/uploads/post-29-1333730084.png[^]

    C / C++ / MFC tutorial question

  • Load image from Open Dialog
    S sadas232341s

    When I start a new Win32 project how to load picture in the white window, say with open file dialog (selected from menu above) :?:?:?:?

    C / C++ / MFC tutorial question

  • BALANCED merge sort
    S sadas232341s

    What does that mean, and what is the difference between just merge sort? Here is the code I use for just merge sort. How to make it BALANCED.

    void Merge(int arr[], int low, int high, int mid)
    {
    int i, j, k, c[50];

    i = low;
    j = mid + 1;
    k = low;
    
    while((i <= mid) && (j <= high))
    {
    	if(arr\[i\] < arr\[j\])
    	{
    		c\[k\] = arr\[i\];
    		
    		k++;
    		i++;
    	}
    	else
    	{
    		c\[k\] = arr\[j\];
    		
    		k++;
    		j++;
    	}
    }
    
    while(i <= mid)
    {
    	c\[k\] = arr\[i\];
    	
    	k++;
    	i++;
    }
    
    while(j <= high)
    {
    	c\[k\] = arr\[j\];
    	
    	k++;
    	j++;
    }
    
    for(i = low; i < k; i++)
    {
    	arr\[i\] = c\[i\];
    }
    
    UpdateData(arr, high + 1);
    

    }

    void MergeSort(int arr[], int low, int high)
    {
    int mid;

    if(low < high)
    {
    	mid = (low + high) / 2;
    	
    	MergeSort(arr, low, mid);
    	MergeSort(arr, mid + 1, high);
    	
    	Merge(arr, low, high, mid);
    
    	SwapsCount++;
    }
    

    }

    C / C++ / MFC question tutorial

  • How to find the most frequent value of string array, and how many
    S sadas232341s

    " to see if the last repetition has not ended." what does that mean?

    C / C++ / MFC graphics data-structures tutorial question

  • How to find the most frequent value of string array, and how many
    S sadas232341s

    It's not working. Gives me "zxc" and 1, but the correct is "qwe" and 3.

    int main()
    {
    string str[8] = {"zxc", "zxc", "asd", "qwe", "qwe", "asd", "qwe", "jkl"};
    vector v_str;
    string t_str, maxstring;
    int maxrep = 1;
    int currep = 1;

    for(int i = 0; i < 8; i++)
    	v\_str.push\_back(str\[i\]);
    
    for(int i = 1; i < v\_str.size(); i++)
    	for(int j = v\_str.size() - 1; j >= i; j--)
    		if(v\_str\[j - 1\] > v\_str\[j\])
    		{
    			t\_str = v\_str\[j - 1\];
    			v\_str\[j - 1\] = v\_str\[j\];
    			v\_str\[j\] = t\_str;
    		}
    
    t\_str = v\_str\[0\];
    maxstring = t\_str;
    
    for(int i = 1; i < v\_str.size(); i++)
    {
    	if(v\_str\[i\] == t\_str)
    		currep++;
    	else if(currep > maxrep)
    	{
    		maxrep = currep;
    		maxstring = t\_str;
    	}
    
    	t\_str = v\_str\[i\];
    	currep = 0;
    }
    
    for(int i = 0; i < v\_str.size(); i++)
    	cout << v\_str\[i\] << endl;
    
    cout << endl;
    
    cout << t\_str << endl;
    cout << maxrep << endl;
    
    return 0;
    

    }

    C / C++ / MFC graphics data-structures tutorial question

  • How to find the most frequent value of string array, and how many
    S sadas232341s

    I did it. Now how to see which element repeats the most and how many times? (Created a new project)

    int main()
    {
    string str[8] = {"zxc", "zxc", "asd", "qwe", "zxc", "asd", "qwe", "jkl"};
    vector v_str;
    string t_str;
    int iNum = 0;

    for(int i = 0; i < 8; i++)
    	v\_str.push\_back(str\[i\]);
    
    for(int i = 1; i < v\_str.size(); i++)
    	for(int j = v\_str.size() - 1; j >= i; j--)
    		if(v\_str\[j - 1\] > v\_str\[j\])
    		{
    			t\_str = v\_str\[j - 1\];
    			v\_str\[j - 1\] = v\_str\[j\];
    			v\_str\[j\] = t\_str;
    		}
    
    for(int i = 0; i < v\_str.size(); i++)
    	cout << v\_str\[i\] << endl;
    
    return 0;
    

    }

    C / C++ / MFC graphics data-structures tutorial question

  • How to find the most frequent value of string array, and how many
    S sadas232341s

    I have a vector string array filled as follows: "s1" "v1" "s1" "f1" "g1" "s1" "s1" "o1" so the result has to be "s1 4". I have to write the string value and the num value in strArtist and iNum. How's that?

    void maxCollByArtist(string& strArtist, int& iNum)
    {
    int max = 0;
    string t_str = "";
    vector temp;

    for(int i = 0; i < m\_vMusic.size(); i++)
    	temp\[i\] = m\_vMusic\[i\].GetArtist();
    
    for(int i = 0; i < temp.size(); i++)
    {
    	//if(temp\[i\] == t\_str)	
    }
    

    }

    C / C++ / MFC graphics data-structures tutorial question

  • positive values count WHILE heap sort
    S sadas232341s

    Yes, the problem is that I don't understand the HeapSort good enough to reshape it whatever I want. That's why i need help..

    C / C++ / MFC algorithms tutorial question

  • positive values count WHILE heap sort
    S sadas232341s

    Well, any suggestions?

    C / C++ / MFC algorithms tutorial question

  • positive values count WHILE heap sort
    S sadas232341s

    How to count positive values WHILE doing HeapSort? Here is my HeapSort and I count them in a loop at the end of the method, but it needs to be done while sorting. How's that?

    void Sift(int arr[], int left, int right)
    {
    int i, j, x;

    i = left;
    j = 2 \* i + 1;
    x = arr\[i\];
            
    while (j <= right)
    {
        if(j < right)
        if(arr\[j\] < arr\[j + 1\]) j++;
    	
        if (x >= arr\[j\]) break;
    
        arr\[i\] = arr\[j\];
        i = j;
        j = 2 \* i + 1;
    }
    
    arr\[i\] = x;
    

    }

    void HeapSort(int arr[], int n)
    {
    int left, right, temp;

    left = n / 2 + 1;
    right = n - 1;
    
    while (0 < left)
    {
    left--;
                    
    Sift(arr, left, right);
    }
    
    while (0 < right)
    {
        temp = arr\[left\];
    arr\[left\] = arr\[right\];
    arr\[right\] = temp;
    
        right--;
    
    Sift(arr, left, right);
    }
    
    // Here I count
    for(int i = 0; i < n; i++)
    if(0 < arr\[i\]) PosCount++;
    

    }

    C / C++ / MFC algorithms tutorial question

  • How to get the column in runtime?
    S sadas232341s

    if (true == ((List)DG.ItemsSource).Any(el =>; el.Name == CurrentInput))
    {
    MessageBox.Show("Looking in column: " + ????? );
    }

    I don' t want to be always in the column Name, but in which is current. DG is the DataGrid. How?

    WPF tutorial question

  • WP7 game for sale
    S sadas232341s

    I' ve build a windows phone 7 game and it's for sale. For more information contact me :)

    Mobile game-dev

  • Binary tree question
    S sadas232341s

    Now If you can explain me how the whole function works...

    ATL / WTL / STL question data-structures tutorial

  • Binary tree question
    S sadas232341s

    OK I think I did it it has to be

    return currentDepth - leftDepth + rightDepth;

    ATL / WTL / STL question data-structures tutorial

  • Binary tree question
    S sadas232341s

    maxDepth is? and why is it in brackets? Is it a function or something? i don' t know

    ATL / WTL / STL question data-structures tutorial

  • Binary tree question
    S sadas232341s

    Yes I define my own Max function, but why the output is 4,3,1 and not only 4?

    ATL / WTL / STL question data-structures tutorial

  • Binary tree question
    S sadas232341s

    And how to call the function? I mean what has to be the second argument innerDepth. I call it with the tree and the Height as second argument and it gives me 4, 3, 1 as output. I need only 4.

    ATL / WTL / STL question data-structures tutorial

  • Binary tree question
    S sadas232341s

    what is max

    ATL / WTL / STL question data-structures tutorial

  • Binary tree question
    S sadas232341s

    I make the program to show the leaves in BST, but how to show only nodes that have leaves as children?

    int OnlyLeafNodes(Elem *t)
    {
    if(NULL == t) return 0;
    if(NULL == t->left && NULL == t->right) cout << t->key << endl;
    else return OnlyLeafNodes(t->left) + OnlyLeafNodes(t->right);
    }

    Here is the INPUT and OUTPUT that I use for test. It has to show 4, instead of 2 and 5. Because 4 is the node that has only leaves. http://img40.imageshack.us/img40/1421/treex.jpg

    ATL / WTL / STL question data-structures tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups