## sk1v3r's Profile User Rating:

Reputation: 231 Stalwart
Group:
Active Members
Active Posts:
670 (0.61 per day)
Joined:
06-December 10
Profile Views:
3,076
Last Active:
Nov 13 2012 03:28 PM
Currently:
Offline

### Previous Fields

Country:
GB
OS Preference:
Linux
Favorite Browser:
Opera
Favorite Processor:
Who Cares
Favorite Gaming Platform:
XBox
Who Cares
Dream Kudos:
0

### Latest Visitors

sk1v3r has not set their status

1. #### In Topic: Function error- normalizing the vector

Posted 9 Nov 2012

Spent ages looking at this, Just realised the problem. On line 75 you are using x in the calculation of the y-value, but the x value was changed the line before. try something like this:
```double length = sqrt( x*x + y*y );
x /= length; // same as x = x / length but easier to type
y /= length;

```
2. #### In Topic: Adjacency-list graph issue

Posted 9 Nov 2012

Simples, I have made this mistake many times
In your append function, you constantly set temp_1 to the next value. But eventually the next value will be null. Even so, temp_1 becomes null and you try and access its variables, then kablooey.
try changing the check to:
```while( temp_1-> next != null )

```
3. #### In Topic: Math Library - Sin and Cos not returning properly question

Posted 9 Nov 2012

All the maths functions use radians I believe, so try something like this
```//Somewhere at the top
#define PI 3.14159

{
return ( degrees / 180 ) * PI
}

```
4. #### In Topic: Function error- normalizing the vector

Posted 9 Nov 2012

Like this:
```return u1*u2 + v1*v2;

```

5. #### In Topic: take 2 inputs if 2 words are type in one line

Posted 9 Nov 2012

The method would be a little laborious if you are content with using the old functions ( also, for the c-stuff I meant getc instead of peek), but an example would be:
```string s;
char c = getc(); // this removes the first character from the stream
// E.G the 'w' in "word", leaving "ord" in the stream
while( c != '\0' && c != ' ' ) // stop when stream ends or the word ends
{
s += c; // add the character to the string you want
c = getc(); // take the next character from the stream
}

```

After this, you could check whether c is a space, meaning that a number follows it, and use scanf to bring it in.

A more c++ approach would be easier, and could look along the lines of
```string s;
int x = 0;
cin >> s; // add the first word to s, leaving either nothing or
// the number
if( cin.peek() == ' ' ) //check whether there is a space following the word
{
cin >> x; // input the number
}

```

### My Information

Member Title:
Age:
18 years old
Birthday:
October 20, 1995
Gender:
Location:
England
Interests:
c++, SDL, game development, games, tv and people
:D
Full Name:
Tom Harris
Years Programming:
2
Programming Languages:
c++, lua, to a lesser extent VB.NET

### Contact Information

E-mail:
MSN:
tomharris000@hotmail.co.uk

### Friends

Page 1 of 1
1. #### sk1v3r

09 Apr 2011 - 17:05
w00t 100 :)
2. #### Gudger

19 Mar 2011 - 18:10
i think i need to rest first.. it's been 24hours that i am awake.. i need to sleep just for 1hour and 30 minutes..to refresh my mind..and i wish when i wake up..your still on line..hehe..I'll be back.. :D
3. #### sk1v3r

15 Feb 2011 - 10:06
oh cool I'm a pioneer :)
Page 1 of 1