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

Reputation: 314 Architect
Group:
Author w/DIC++
Active Posts:
1,523 (0.73 per day)
Joined:
16-May 09
Profile Views:
34,706
Last Active:
User is offline Yesterday, 03:52 PM
Currently:
Offline

Previous Fields

Country:
IR
OS Preference:
Linux
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
1150

Latest Visitors

Icon   Anarion has not set their status

Posts I've Made

  1. In Topic: issue with templates

    Posted 31 Jan 2015

    View Postmegagig, on 01 February 2015 - 12:08 AM, said:

    Oh wow thank you!!! Yeah our instructor drills into us to NOT put code in the header file :P/>

    Your instructor actually has a good point in that, but it only works for non-template classes (given the way your code currently is). Here you can find good information on this situation and possible methods to cope with it.
  2. In Topic: C++ code reading a file into an array then reversing the array

    Posted 22 Jan 2015

    In addition to jimblumberg's post, you are doing the file input wrong. Notice:
    	ifstream fin ("numbers.dat");  
    
    	//some code
    
    	while (!fin.eof() && position < array_size)
    	{	
    		//some code
    	}
    

    The reason is that in C++ file streams, eof is accessible as an error flag (notice how it is used: fin.eof() which returns a bool value). It is only set to true when the object tries to read past the end-of-file character. You should change the loop to something like this:
    	ifstream fin("numbers.dat");
    	//some code, also checks to see if the file is opened without errors
    	double num[array_size]; //assuming array_size was initialized prior to this line
    	std::size_t count = 0;
    	while(fin>>num[count] && count < array_size) {
    		++count;
    	}
    

    You should read up on formatted input vs. non-formatted input in C++.
  3. In Topic: Read/writing files.

    Posted 17 Jan 2015

    It's nothing difficult, in case you are familiar with streams and how they work. It is possible to give getline a third parameter, a character, which is the delimiter. The default value as the name "getline" suggests is the new-line character \n. But in your case, there is (currently) no new-line involved. Instead, you have to deal with comma.

    Lets examine this code:
    ifstream file("something.txt");
    string s;
    getline(file, s, ',');
    

    The third line of code reads a line and stores it in s. The words I used in the previous sentence might be a bit ambiguous: you didn't read a line really! You read until a comma was reached!

    Also take note that operator>> does formatted input, which seems like a good method to be used for inputting integers in your case. Try to see if you can use a mixture of getline (for strings) and operator>> (for integers and numerals) for your task, it seems to be working! ;)

    Spoiler
  4. In Topic: New Year, New Admin- Modi123_1

    Posted 17 Jan 2015

    Well deserved!
  5. In Topic: c++ function

    Posted 5 Jan 2015

    Is there something not working as expected? It seems you have forgotten to mention your problem with this code.

My Information

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

Contact Information

E-mail:
Private
Twitter:
http://twitter.com/anarion1191

Comments

Page 1 of 1
  1. Photo

    Hybrid SyntaX Icon

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

    estherNamogo Icon

    03 Nov 2013 - 06:33
    Hello
    Nice to meet you write
    me at (esther2namogo@hotmail.com) i will send you my picture OK.
  3. 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;<...
  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
    thanks
  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