darek9576's Profile User Rating: ***--

Reputation: 202 Stalwart
Group:
Active Members
Active Posts:
1,701 (0.85 per day)
Joined:
13-March 10
Profile Views:
47,734
Last Active:
User is offline Aug 24 2015 07:22 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   darek9576 has not set their status

Posts I've Made

  1. In Topic: When object variables "overwrite" eachother

    Posted 24 Aug 2015

    You might check out static members. Instance variables will always be specific to an object.
  2. In Topic: missing template arguments before

    Posted 23 Aug 2015

    This does not answer your question, but if you have access to Boost libraries, you could use boost::algorithm::to_upper() or boost::algorithm::to_upper_copy() functions as the following:

    #include <vector>
    #include <boost/algorithm/string.hpp>
    void boostExample(){
    	std::vector<std::string> words = { "this", "is", "a", "lower", "case", "sentence" };
    	std::for_each(std::begin(words), std::end(words), [](const std::string & e) { 
    		std::cout << boost::algorithm::to_upper_copy(e) << " "; }
    	);
    }
    
  3. In Topic: Help with finding the sum of odd numbers using an array

    Posted 5 Aug 2015

    bool isOdd(int x) {
      if(x%2 != 0)
        return true;
    }
    bool isEven(int x) {
      if(x%2 == 0)
        return true;
    }
    
    



    What if those if statements return false. You need to return a boolean value on every execution path.

    I also do not think you are allowed to use std::array<> or std::vector<> but if you were, then you could do:

    std::vector<int> numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
    int sum = 0;
    std::for_each(std::begin(numbers), std::end(numbers), [&sum](const int & element){ if (element % 2 != 0) sum += element; });
    std::cout << "The sum of odd elements is: " << sum << std::endl;
    
    
  4. In Topic: Book Suggestion on pipelining and related.

    Posted 29 Jul 2015

    Well, i am interested in C++.
  5. In Topic: The C/C++ Learning Series

    Posted 18 Jun 2015

    Are smart pointers going to be covered in the same place as pointers? Or maybe there should be a separate section for smart pointers in Advanced section. I would also add rvalue references and move semantics to the list.

My Information

Member Title:
D.I.C Lover
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

darek9576 hasn't added any friends yet.

Comments

darek9576 has no profile comments yet. Why not say hello?