Xupicor's Profile User Rating: *****

Reputation: 275 Architect
Group:
Expert
Active Posts:
653 (0.43 per day)
Joined:
31-May 11
Profile Views:
11,173
Last Active:
User is offline Today, 04:33 AM
Currently:
Offline

Previous Fields

Country:
PL
OS Preference:
Linux
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   Xupicor is hoping to work on a quite interesting programming project in the near future! Yay for that!

Posts I've Made

  1. In Topic: Is it bad practice to your function variables the same?

    Posted 4 Aug 2015

    Well, calling it "vec" is a bit redundant since we readily see that it's a "vector" - we can see the type just in front of the name. ;) Still "v" is quite short, general name when you need a temporary vector or something. You might argue that "collection" is a redundant name too, since we already know that it's a collection - std::vector is a collection type after all. :P It might be called "numbers"... But, well, collection isn't that bad of a name I guess.
  2. In Topic: Is it bad practice to your function variables the same?

    Posted 4 Aug 2015

    I sense a possible disturbance in the Force... You do realize that the name of the parameter does not need to correspond in any way to the name of the variable you pass as a parameter, right? Parameters are usually a bit broadly named, while variables can have specific names that tell you more about what they are:

    #include <vector>
    #include <numeric>
    #include <iostream>
    
    double average(std::vector<int> collection) {
        int sum = std::accumulate(collection.begin(), collection.end(), 0);
        return static_cast<double>(sum) / collection.size();
    }  
    
    int main() {
        std::vector<int> prices = { 570, 808, 503, 892, 920, 428 };
        std::vector<int> ages   = { 57, 88, 53, 89, 90, 39 };
        std::vector<int> diameters = { 7, 8, 5, 8, 9, 4 };
        std::vector<int> numbers_from_file = { 2357, 388, 53, 9989, 9330, 429 };
        
        std::cout << average(prices) << "\n"
                << average(ages) << "\n"
                << average(diameters) << "\n"
                << average(numbers_from_file) << "\n";
            
        return 0;
    }
    

    I name my variables and parameters so their names are useful - in the `average()` function I'm not averaging some specific set of chickens or prices, it calculates the average of whatever collection of integers I give it, thus the name is quite general. However, my variables are representing sets of specific things, and they are named accordingly.
  3. In Topic: Help with basic array program

    Posted 4 Aug 2015

    Edited my post accordingly. Jim is obviously right, I could swear on my head that it was an int array and int variables... and I would loose it, since the post wasn't edited. I'm sorry, that's completely my mistake. I should have compiled the code - as Jim says, compiler with a good set of flags (like -Wall -Wextra and maybe -std=c99 or std=c11 for GCC) will tell you that there's something wrong. I assumed that "Enter a name" was a leftover and you actually wanted "Enter number" there, but if you actually want an array of c-strings, and not a 2D array of ints, then that was a completely false assumption.

    Again, sorry about that. I usually try to avoid blunders like that, but things slip under the radar...
  4. In Topic: Help in fseek and offset.

    Posted 4 Aug 2015

    My point was - what exactly happens? Yes, if the file fails to be opened you do display a message... And then continue as if the file was opened correctly.
    You do indeed check whether the given word is found in a line and display a message if it is... And then you continue without using that information in any way.

    Is that what you want?
  5. In Topic: Help in fseek and offset.

    Posted 3 Aug 2015

    gets(str); Tssk. Never use gets(). Ever. ;)

    Another thing that is readily apparent - can you tell us what happens when you can't open the text.txt file?

    Also, can you explain in your own words what exactly happens here, line by line:
    /*finding match*/
        while(fgets(temp,2000,fp)!=NULL)
        {
            if((strstr(temp,str))!=NULL)
            {
                printf("A match found.\n");
            }
            else
                printf("Match not found");
        }
    
    

My Information

Member Title:
Nasal Demon
Age:
29 years old
Birthday:
March 20, 1986
Gender:
Location:
Paris, France
Interests:
Programming, IT, bits of cosmology and philosophy, history (focusing on WWII lately), s-f (Asimov, Lem, Dick...) and fantasy (Tolkien, Sapkowski, Le Guin, Modesitt...) books, good movies (Tarantino, Nolan, Polański, Scorsese, Kurosawa, Kubrick... and more), sometimes an anime movie or series (Ghost in the Shell, Cowboy Bebop, LoGH, House of Five Leaves, Mononoke, etc). I enjoy playing RTS and RPG games (that includes browser text-based fable-driven ones), and sometimes hunting my pals as an alien in AvP2, or playing as a platoon commander (or helicopter pilot) in Battlefield 2.
Full Name:
Tomasz Wota
Years Programming:
5
Programming Languages:
Pretty good: C, C++, PHP
Not too shabby: Java, JavaScript, Python
Bit rusty: Perl
Can't remember a thing: Atari 128 & Commodore 64 BASIC, Pascal
Learning (or planning to): C#, LUA, Haskell, Scala
Thinking about glancing trough: Mathematica, D, Objective-C, Go, R, Clojure, Curl (not libcurl :P)

Contact Information

E-mail:
Private

Comments

  • (7 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  1. Photo

    .Aaron Icon

    07 Feb 2014 - 15:43
    "Twilight zone it is. That's where aresh lives, actually. ;)"
    Lol. Yea.. I'll believe that.
  2. Photo

    jesicalbaby Icon

    16 Sep 2013 - 14:02
    Hello
    My name is Miss jesical,
    i saw your profile today
    and,i fill more interest to contact you ,
    i will like you to please send me
    an email via (jesicalduncan22@yahoo.com)
    for me to send you my picture
    jesicalduncan22@yahoo.com
  3. Photo

    aresh Icon

    17 Aug 2013 - 06:20
    Is our love also dead?
  4. Photo

    aresh Icon

    14 Aug 2013 - 03:10
    You liar, now you'll even kill your mother just to break off with me? I'm offended... My skills in bed aren't that bad, you know.. :(
  5. Photo

    aresh Icon

    13 Aug 2013 - 01:37
    No, it's not. I've seen you naked, doing the dance for me. The fact that your mom caught us at that moment changes nothing!
    Traitor! :'(
  6. Photo

    aresh Icon

    05 Aug 2013 - 07:50
    After we slept together last time, you didn't even bother to call me once? You traitor!
  7. Photo

    aresh Icon

    05 Jun 2013 - 10:21
    And I see you're seeing my profile... I got myself a stalker, huh? ;)
  8. Photo

    aresh Icon

    05 Jun 2013 - 10:21
    Ya know, Surely You're Joking was awesome, but What do you care wasn't all that superb..
  9. Photo

    aresh Icon

    04 Jun 2013 - 17:33
    Oh, and I also talk to myself, especially when solving a problem or thinking about something :P
  10. Photo

    aresh Icon

    04 Jun 2013 - 17:32
    His name is funny enough as it is :P
    And I also think people stare at me -.-
  11. Photo

    aresh Icon

    04 Jun 2013 - 16:28
    Come on, with your skills, you should be able to find a job in IT pretty soon.
    BTW, I completed Surely You're Joking, Mr Feynman, and it was awesome ^_^
  12. Photo

    aresh Icon

    03 Jun 2013 - 17:40
    Ya know, the book which you recommended is not exactly a novel, but it's good nonetheless. I am enjoying reading it :D
  13. Photo

    aresh Icon

    03 Jun 2013 - 15:30
    Well, will be sure to check them out :)
    Other than that, how's your life going?
  14. Photo

    aresh Icon

    03 Jun 2013 - 14:49
    OK, the first two are books?
  15. Photo

    aresh Icon

    03 Jun 2013 - 14:21
    Seeing how your last recommendation was Song of Fire and Ice, I'll definitely try his works :D Any work in particular?
  • (7 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »