## binaryferret's Profile User Rating:

Reputation: 3 Apprentice
Group:
New Members
Active Posts:
6 (0.01 per day)
Joined:
27-May 12
Profile Views:
197
Last Active:
Mar 25 2014 03:49 AM
Currently:
Offline

### Previous Fields

Country:
GB
OS Preference:
Who Cares
Favorite Browser:
FireFox
Favorite Processor:
Who Cares
Favorite Gaming Platform:
PC
Who Cares
Dream Kudos:
0
binaryferret has not set their status

1. #### In Topic: What are you reading and what is on your book stack to read?

Posted 17 Mar 2014

I'm currently listening to Wool by Hugh Howey. It's awesome.
2. #### In Topic: real quick question, converting char index to int

Posted 10 Sep 2013

NecroWinter, on 09 September 2013 - 06:44 PM, said:

This seems to be solved

I'm not familiar with how C++ handles this, and it seems atoi doesnt really do what I'm looking for, unless I'm just overlooking something.

```#include <iostream>
#include <cstdlib>

using namespace std;

int main()

{
char a[2];
a[0]='3'; a[1]='1';
cout << a[0] << " line 1 " << endl;
cout << a[1] << " line 2 " << endl;
cout << a[0] + a[1] << endl;
return 0;
}

```

Hi, I know you posted something that 'works' but in case you don't really understand why, I thought I'd reply.

when you type a[0] = '3' you're assigning a[0] with the value 51. If you check out an ascii table, you can see that the value 51 maps to the character '3'. So you've said

a[0] = 51.

In this case a[1] = 49

so in your cout statement you're summing 51 with 49.

In your solution you are subtracting the value 48 ('0' = 48 see ascii table)

so

51 - 48 = 3
49 - 48 = 1

Hope that clarifies the why.
3. #### In Topic: Beginning with DeV C++

Posted 8 Sep 2013

Soumikbhat, on 07 September 2013 - 10:16 PM, said:

Ryano121, on 07 September 2013 - 11:31 AM, said:

You are missing an opening curly brace after int main().

I encourage you to use proper indentation which would highlight this issue a lot.

You should also consider upgrading your compiler. Dev C++ is now very old. For C++ nowadays I recommend either CodeBlocks or Visual C++ Express (both are free)

Yes I missed those things (like a semi-colon after the for loop etc..) while pating the code here..The complete code was something of this sort
```#include <stdio.h>
#include <conio.h>
#include <stdlib.h>

int main()
{
int d,i;
printf("Enter a number");
scanf("%d",&d);
for (i=2;i<=(d-1);i++)
{
if (d%i==0)
printf("%d",i);
}
system("PAUSE");
return 0;
}
```

Just as a follow up on indenting your code which Ryano121 recommended. I'd recommend indenting all your 'blocks.' You only seem to have taken Ryano advice and indented everything in your main function.

```
int main()
{
int d,i;
printf("Enter a number");
scanf("%d",&d);
for (i=2;i<=(d-1);i++)
{
if (d%i==0)
printf("%d",i);
}
system("PAUSE");
return 0;
}

```

Hopefully you can see how much easier it is to read the code.
4. #### In Topic: Hello from the Northwest of England.

Posted 12 Oct 2012

wordswords, on 11 October 2012 - 03:21 PM, said:

binaryferret, on 04 October 2012 - 10:53 PM, said:

Name: Nathan
Location: North West England
Age: 28 (Mature Student)

Ah a fellow northerner, welcome to Dream in Code!

I work for the BBC in Salford Quays, Manchester. Are you studying at any unis around Manchester? I know Manchester uni is good for CS.

Hi matey,

I study at The University of Salford which is pretty darn close to the new BBC site.

Thanks for the welcome
5. #### In Topic: Hello from the Northwest of England.

Posted 5 Oct 2012

rickymartin, on 05 October 2012 - 08:36 AM, said:

Thanks matey.

Member Title:
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Location:
Wigan

### Contact Information

E-mail:
Private
Website URL:
http://www.binaryferret.com