sk1v3r's Profile
Reputation: 231
Stalwart
- Group:
- Active Members
- Active Posts:
- 670 (0.75 per day)
- Joined:
- 06-December 10
- Profile Views:
- 2,641
- 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
- Your Car:
- Who Cares
- Dream Kudos:
- 0
Latest Visitors
-
Tom_Leonardsson 
11 May 2012 - 17:20 -
ButchDean 
19 Feb 2012 - 16:14 -
DimitriV 
03 Jan 2012 - 21:13 -
sara-92 
01 Jan 2012 - 13:56 -
Eitxor 
11 Dec 2011 - 10:29 -
brep 
07 Dec 2011 - 15:10 -
Martyr2 
31 Oct 2011 - 12:24 -
malmazan1 
27 Oct 2011 - 09:25 -
AmbientTech 
10 Oct 2011 - 09:54 -
darek9576 
29 Aug 2011 - 15:17
Posts I've Made
-
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;
-
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 )
-
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 double degreesToRadians( double degrees ) { return ( degrees / 180 ) * PI } -
In Topic: Function error- normalizing the vector
Posted 9 Nov 2012
Like this:
return u1*u2 + v1*v2;
-
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:
- D.I.C Addict
- Age:
- 17 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:
- Click here to e-mail me
- MSN:
-
tomharris000@hotmail.co.uk
Friends
|
|


Find Topics
Find Posts
View Reputation Given

|
Comments
sk1v3r
09 Apr 2011 - 17:05Gudger
19 Mar 2011 - 18:10sk1v3r
15 Feb 2011 - 10:06