Anarion's Profile User Rating: *****

Reputation: 381 Architect
Group:
Author w/DIC++
Active Posts:
1,658 (0.67 per day)
Joined:
16-May 09
Profile Views:
41,521
Last Active:
User is offline Jan 30 2016 11:16 AM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Linux
Favorite Browser:
FireFox
Favorite Processor:
AMD
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
1200

Latest Visitors

Icon   Anarion has not set their status

Posts I've Made

  1. In Topic: Create DLLs in C++

    Posted 10 Jan 2016

    Creating a DLL in C++ (using Visual Studio)

    Calling DLL Functions From Visual Basic
  2. In Topic: how to return the values in a if selection of a function?

    Posted 18 Dec 2015

    If you could specify more clearly what the problem is (also where it is), we would be able to help you faster and more accurate. Based on the topic's title, I see that you are wondering how to return the value from inside an if-statement? But then, I am not sure of what part of the source code you are talking about.

    Reviewing your code, you could refactor the following function (not related directly to the question you had, but it improves your code's readability!):
    int computeC(double f[], int a)
    {
        double C;
    
        for (int j=0; j<a; j++)
        {
            C=(5*(f[j]-32))/9;
            f[j]=C;
            cout << f[j] << endl;
        }
        return a;
    }
    

    In the above function, the return value is completely unnecessary,. You are passing a to the function as it's second argument, and then at the end you are returning this value. This is redundant and you can get rid of it.
    Also, variable C is redundant. After these modifications:
    void computeC(double f[], int a)
    {
        for (int j=0; j<a; j++)
        {
            f[j] = (5*(f[j]-32))/9;
            cout << f[j] << endl;
        }
    }
    

    Now, this function is converting the given array's values from Fahrenheit to Centigrade. If you need to preserve the Fahrenheit values, then you need to create another array of the same size inside this function and return it as a result of the conversion.

    As a general design guideline, I would suggest to have the following in mind for most functions (until you get familiar with classes):

    Quote

    Each function should take an input (or more), process it, and then return the result as output.

    Whenever possible, try to keep input and output as separate entities and do not mix them together. This can help you avoid problems/confusions later on.
  3. In Topic: Move Semantics

    Posted 15 Dec 2015

    I few months ago I decided to play with move semantics to learn more about them. Alright, not a few months, it was more than a year ago! There is a test project for move semantics on my laptop hidden deep down somewhere :whistling:
    Anyways, nice post! Although personally I tend to keep away from macros as much as possible.
  4. In Topic: Datain.fail function

    Posted 2 Dec 2015

    What have you done so far and what exactly is the problem you are facing? What is your approach to accomplish this task?
  5. In Topic: return the address from a function

    Posted 17 Nov 2015

    One reason to return an address from a function would be if you are constructing an object inside the function and you intend to keep it alive after the function's scope is ended:
    SomeObject* function() {
        SomeObject* p_object = new SomeObject; //allocate and construct an object
        //some code
        return p_object;
    }
    

    But there is one other thing: using naked pointers like above is not a good practice. Why? Because the chances of messing it up is high. You could use a smart pointer instead, to do exactly the same but also avoid most of the nasty pitfalls.

    There may be situations that the best option is to use a raw pointer, due to resource/system limitations. But if there are no limitations, using raw pointers doesn't seem to be the best option ;)

My Information

Member Title:
The Persian Coder
Age:
23 years old
Birthday:
May 17, 1992
Gender:
Interests:
Music, Tennis, Programming, KitKat, Cars, Bikes
Full Name:
Kian
Years Programming:
7
Programming Languages:
C++, Java, PHP, R

Contact Information

E-mail:
Private

Comments

Page 1 of 1
  1. Photo

    Xupicor Icon

    31 Aug 2015 - 13:05
    Well, you can hit me up on Steam or gmail at the same handle. ;) I'm also from time to time at TeamSpea if you prefer that, I don't use Skype.
  2. Photo

    Xupicor Icon

    27 Aug 2015 - 08:06
    You're doing a nice job, in the help and in the tutorial section, yourself. ;) I was seriously thinking about making a video tutorial on C++, featuring exempts from the standard to source stuff (they'd be shown as a visual side-note, since they themselves would be way too dry for a beginner), but it's a scary amount of work...
  3. Photo

    Xupicor Icon

    26 Aug 2015 - 07:00
    You really went to town with those upvotes today. :P
  4. Photo

    Hybrid SyntaX Icon

    10 Feb 2014 - 14:02
    sup?
  5. Photo

    estherNamogo Icon

    03 Nov 2013 - 06:33
    Hello
    Nice to meet you write
    me at ([email protected]) i will send you my picture OK.
  6. Photo

    jatinjindalj Icon

    06 Sep 2012 - 09:01
    Hey Regarding your code snippet at
    http://www.dreamincode.net/code/snippet4621.htm-->
    Can you please explain:
    why when at line 37 and 38,If I do
    while(q!= NULL) {//Line 37
    q = q->link;
    }
    t = new node;
    t->data = str;
    t->link = NULL;<...
  7. Photo

    Anarion Icon

    07 Aug 2012 - 06:23
    Thanks! I had made it for DIC Signature Contest and put it on my sig since then.
  8. Photo

    AnalyticLunatic Icon

    06 Aug 2012 - 09:05
    Just wanted to drop by and say Sweet Sig. Sometime I need to make one for myself.
  9. Photo

    David W Icon

    07 Jun 2012 - 00:31
    Shalom shalom my Regal Persian Coder Friend
  10. Photo

    Anarion Icon

    16 Mar 2011 - 00:56
    @abrsefid: ba arze sharmandegi, komaki az man sakhte nist. Az beine portha faghat ba USB kar kardam oon ham dar sathe kheili payin. Be shoma pishnahad mikonam baraye javabe soaletun dar internet jostejoo konid :)
  11. Photo

    yogesh201010 Icon

    05 Mar 2011 - 18:41
    hi i am yogesh
    how to connect internet by mob in linux.
    and tell me book for linux learning
    thanks
  12. Photo

    abrsefid Icon

    27 Feb 2011 - 05:23
    salam man donbale 1 code c++ (ubuntu) migardam vase send o receive data ba port serial mishe rahnamaeem konid ?
  13. Photo

    hamishehiran Icon

    10 Aug 2010 - 23:02
    thanks for add! ;) nice to meet you!
  14. Photo

    Anarion Icon

    28 Mar 2010 - 08:27
    Thanks! Happy new year to you too :)
  15. Photo

    saSBH2 Icon

    28 Mar 2010 - 07:03
    Happy New Year :)
Page 1 of 1