Anarion's Profile User Rating: -----

Reputation: 316 Architect
Author w/DIC++
Active Posts:
1,533 (0.7 per day)
16-May 09
Profile Views:
Last Active:
User is offline May 22 2015 07:33 AM

Previous Fields

OS Preference:
Favorite Browser:
Favorite Processor:
Favorite Gaming Platform:
Your Car:
Who Cares
Dream Kudos:

Latest Visitors

Icon   Anarion has not set their status

Posts I've Made

  1. In Topic: Default case in switch statement

    Posted 21 May 2015


    how to make the program automatically choose the default case in a switch statement after a certain amount of time has passed with no user input

    So, based on that, you need to keep track of the time passed (C++11 Chrono). To be able to do that while you are waiting for user input, you should take a look at multi-threading. I am not sure if doing so is the right thing for you right now, it might be too advanced if you are not much familiar with the standard library.

    Edit: almost forgot! You need break; for the default case too! Although right now it's not any useful for reaching your goal.
  2. In Topic: Substring Printing using a For loop

    Posted 19 May 2015

    You should pay attention to the way index numbers are considered in C++. They start from 0.
    So, if you have a string with 4 characters... what are the valid indexes?
  3. In Topic: Moving forward in C++

    Posted 15 May 2015

    Use one of the C++ GUI libraries assuming you understand the language good enough. I can't emphasis this more, find a good library that is actually made for C++. You can always use C libraries in C++ but for your situation, it's not a good idea; it ruins your coding habits because the two languages are not the same. In fact, the latest C++ standard almost feels like a new language by itself.

    Here's my story:
    I have worked with Qt before for a time-series data forecasting project. First, I wrote the back-end (which means I used CLI at first) and did as much testing as possible. Then, I brought that into a Qt project and wrote the front-end GUI for it. For learning Qt, I used this book. However, a new version of Qt came out and this book is for the previous version! There are also tons of tutorials that you can find.

    You can find a project you like, and develop a front-end GUI for it. Or even better, make a front-end for one of your own projects.
  4. In Topic: Classes in multiple files

    Posted 13 May 2015


    cout << "F**k classes in seperate files";

    How could you say such a thing? :o

    LOL! I understand the frustration, but you will see the benefit later if you continue to work with C++ on a larger project :)
  5. In Topic: Initialization of dynamic memory in c++

    Posted 13 May 2015

    Let's take a look at what you are doing in this loop:
    for(int i =0; i <10; ++i) {
        *x = 10;

    You are iterating over the dynamic array. However, you are updating the pointer each time to point to the next element of the array. So, when this loop is finished, x is not pointing to the beginning of the array anymore!
    Right after it, you have another loop to display the results:
    for(int i = 0; i < 10; ++i) {
        std::cout<<i<<" is "<<x[i]<<std::endl;

    What does x[i] mean? It means the i-th element of the array, starting from where x points to. However, you have changed x and now it does not point to the beginning of the array anymore! So this second loop goes out of bounds of the array.
    You have the answer in your own code. Change the first loop and make it access the array just like you did with the second loop:
    for(int i =0; i <10; ++i) {
        x[i] = 10;


    Last but not least, you forgot to free the dynamic memory you have allocated. When you use new, you are responsible to free this memory whenever it's appropriate and you're done with it:
    delete[] x; //after you are done with x

My Information

Member Title:
The Persian Coder
23 years old
May 17, 1992
Music, Tennis, Programming, KitKat, Cars, Bikes
Full Name:
Kian Nezhadfard
Years Programming:
Programming Languages:
Good At: C++
Know some: PHP, Bash
Learning: Python, R

Contact Information



Page 1 of 1
  1. Photo

    Hybrid SyntaX Icon

    10 Feb 2014 - 14:02
  2. Photo

    estherNamogo Icon

    03 Nov 2013 - 06:33
    Nice to meet you write
    me at ( i will send you my picture OK.
  3. Photo

    jatinjindalj Icon

    06 Sep 2012 - 09:01
    Hey Regarding your code snippet at>
    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;<...
  4. 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.
  5. 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.
  6. Photo

    David W Icon

    07 Jun 2012 - 00:31
    Shalom shalom my Regal Persian Coder Friend
  7. 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 :)
  8. 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
  9. 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 ?
  10. Photo

    hamishehiran Icon

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

    Anarion Icon

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

    saSBH2 Icon

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