2,712 Posted Topics

Member Avatar for sfrider0

Its because you don't have your normals calculated for rectangles. Plus put your lighting function in our initGL function.

Member Avatar for sfrider0
0
162
Member Avatar for ured

>>like if I have 0000.9876 will be stored as 9876 If this is exact then, you are making it too complicated. Just have a variable that starts where the string has the '.' character then increment it by one and then copy it. [code] string S = "000.123"; int stringIndx …

Member Avatar for jonsca
0
108
Member Avatar for luskbo

just do this : [code] string input; string s = "$$$"; ifstream iFile("ReadMe.txt"); while(getline(iFile,input)) { if(input == s) break; else cout<<input<<endl; } [/code] Haven't tried it but that logic should work.

Member Avatar for mrnutty
0
182
Member Avatar for robertmacedonia

>> How will i recognize the need of using the copy constructor ? Usually when you have a class that uses dynamic memory then you need to create your own copy constructor so when copying a value, each variable has its own memory location for its member variables. For example …

Member Avatar for mrnutty
0
141
Member Avatar for samsons17

>>i not sure what is the single quote means... Its usually used with char variables : [code] char quit = 'n'; if( quit == 'n' ) cout<<"Still playing\n"; [/code]

Member Avatar for mrnutty
0
80
Member Avatar for jhanthem

cant you just do this : [code] void xSinX(int * A, int SZ, int lim){ for(int i = 0; i < lim && i < SZ; i++){ A[i] = i*sin( float(i) ); //xsin(x) } } [/code]

Member Avatar for vmanes
0
165
Member Avatar for gretty

[QUOTE=gretty;1033522]Hello I am not sure if my function below will completely delete a linked list. I am worried it will delete every element of the list except for the head(first node)? For example; If I have this linked list below Will my function delete the 1st node (1)? [CODE] void …

Member Avatar for mrnutty
0
87
Member Avatar for erlene

Maybe the quality of the game and/or the features of the game is not supported by your video card.

Member Avatar for lisalin
0
126
Member Avatar for Towely

[QUOTE=Towely;1033614]Here's my code. [CODE]int main () { int input; cout <<"Enter a sequence of numbers (0 to quit): "; cin >> x; if (x != 0) { if (x % 2 == 0) { cout << x << " is even" << endl; } else if (x % 2 != …

Member Avatar for Towely
0
144
Member Avatar for thetechguy

Just for trial, try putting : using namespace SAMSErrorHandling; at the top of your main.

Member Avatar for thetechguy
0
119
Member Avatar for aligahk06

Suggestions from a college student : Reasons on why some Professors are better than other 1) Enthusiastic about their subject. 2) Knowledgeable about their subject 3) Clear with explanation 4) Start from basic to advance 5) Be descriptive on even the small things 6) Realize that the MOST easy thing …

Member Avatar for mrnutty
0
106
Member Avatar for RobBrown

Good start, now first implement isPrime function first, and test it out with a loop from 0 to 100. Remember a prime number can only be a prime if it is only EVENLY divisible by itself and 1. That means if the mod operator return testPrime % index== 0 is …

Member Avatar for Sky Diploma
0
285
Member Avatar for ejam

How about you give it a go and we'll see how it goes from there. Be sure to use code tags when posting code.

Member Avatar for mrnutty
0
42
Member Avatar for restrictment

[QUOTE=restrictment;1032043]Ah, ok. I tried this...but it still doesn't work: [code] ...... if(info == 'c') { gauge[0]='C'; gauge[1]='F'; values(float value1[11]); for(int x=0;x<=10;x++) value2[x]=(value1[x]*9)/5+32; } else { gauge[0] = 'F'; gauge[1] = 'C'; values(float value1[11]); for(int x=0;x<=10;x++) value2[x] = ((value1[x] - 32) * 5)/9; } ............... [/code][/QUOTE] your function call should be …

Member Avatar for restrictment
0
126
Member Avatar for gcardonav

You get seg fault. because your overflowing stack. It seems that you want a number ranging from 0.1 to 0.999 Look [URL="http://www.daniweb.com/code/snippet217455.html"]here[/URL]

Member Avatar for mrnutty
0
162
Member Avatar for mymyzzz

//if the file is exactly like that then you can do this : [code] ifstream iFile("file.txt"); string str ; float num1; float num2; float num3; iFile >> str; //read the string iFile >> num1 >> num2 >> num3; //read the number [/code] If you wan't something else be clearer.

Member Avatar for mrnutty
0
108
Member Avatar for freddyvf

Sure, but first be clear in your question. How to make a table is a vague question. Exactly what kind of table do you have in mind?

Member Avatar for mrnutty
0
64
Member Avatar for racumin

How about dynamically allocating your Node, then your return type can be of Node***. Alternative, you can use 3d vectors and have the return types as 3d vectors as well.

Member Avatar for Sky Diploma
0
157
Member Avatar for M.Jama

>>Hi there, Hello there. >>I am new in java and some basic help would be appreciated. e.g Ok lets see... >>1-What's the out put of; >>double number = (1/3)*3; >>System.out.println("(1/3)*3 is equal to " + number); >>What's missing? Did you try this out on a compiler ? Is this a …

Member Avatar for M.Jama
0
88
Member Avatar for maverick405

You need to set the stream flags, look below : [code] cout<<fixed; //make it so that 3.000 comes out instead of 3 cout.precision(2); // make it so that 3.00 comes out [/code] Now when you print something like cout << GPA << endl; and if GPA is a whole number …

Member Avatar for maverick405
0
284
Member Avatar for ab00120

In your first post you haven't defined a name within scope. I think what you are trying to is something like this : [code] #include<iostream> #include<string> using namespace std; class Test { string name; public : Test(string str) { name = str; } Test() { name = "NULL"; } void …

Member Avatar for ab00120
0
96
Member Avatar for swinefish

>> However, when rotating a cube, my cube slowly shrinks. Is this s result of loss of accuracy in Math.sin() and Math.cos()? Or is it possibly because I'm casting these values to float, since I use this later for drawing... Rotating the cube has nothing to do with its size! …

Member Avatar for mrnutty
0
130
Member Avatar for itzaaron

Tell me in psuedo code what each of these function below needs to do in order to achieve its purpose[code] void reverse(char unencrypted[], char encrypted[]); void flip(char unencrypted[], char encrypted[]); [/code]

Member Avatar for mrnutty
0
2K
Member Avatar for JoQsh

or you can just make your own function : [code] int round(float num){ return (int)(num+0.5); } int roundDown(float num){ return (int)(num); } [/code] example output : [code] Enter a number : 3.14 Round = 3 roundDown = 3 Enter a number : 3.5 Round = 4 roundDown = 3 [/code] …

Member Avatar for JoQsh
0
152
Member Avatar for GooeyG

in your preprocessor add : using std::vector; Use the rand function in your library to place the battleship in random spot. Something like this : void placeRandomly(){ int x = rand()%MAP_SIZEX; int y = rand()%MAP_SIZEY; this.place(bigShip, x , y); }

Member Avatar for mrnutty
0
267
Member Avatar for fragtech

Look up the definition of a prime number, and you will see that it is a number that can only be divisible evenly by itself and 1. For example , 3 is a prime number because 3 can only be divided by its self(3) and 1, without having any remainder …

Member Avatar for mrnutty
0
541
Member Avatar for jmoran19

Just to add, another way to prase string using sstream : [code] void praseString(string& src, float dst[], int size){ stringstream convert; convert << src; for(int i = 0; i < size; i++) convert >> dst[i]; } [/code]

Member Avatar for jmoran19
0
113
Member Avatar for abdelhakeem
Member Avatar for abdelhakeem
0
173
Member Avatar for aznswti85

>>WHAT IS WRONG WITH THIS CODE? 1) You do not use code tags 2) You haven't included the necessary library 3) I don't think you understand what the question is asking, so understand it before you write the program. I'll try to break the question down for you : [code] …

Member Avatar for IT seeker
0
162
Member Avatar for IT seeker

Welcome, a few things : 1) When posting a question : 1_a) Make sure you research first 1_b) Ask question clearly 1_c) Use code tags 2) Try your best to write in a good grammatical way, and try not to use slang language, yo. MIT, huh? How is it there? …

Member Avatar for IT seeker
0
80
Member Avatar for fhast

At this stage(I am assuming), it may be easier( for you) to create a function, like so : [code] class Timer { int h,m,s; public : void getTime() { cin >> h >> m >> s; } } [/code]

Member Avatar for fhast
0
7K
Member Avatar for noey699

Is this for a tradition pong game, where the paddle could only have 1 x coordinate and move only up or down?

Member Avatar for mrnutty
0
80
Member Avatar for shamila08

You need a conversion equation , look below as an example : [code] #include<iostream> using namespace std; int main(){ const int R = 4; const int C = 4; int A[R * C]; for(int i = 0; i < R*C; i++) A[i] = i; //print out as row and colum …

Member Avatar for mrnutty
0
279
Member Avatar for zahra81
Member Avatar for ravenrider

Hint, when you declare a function prototype inside a class, make sure it has the same signature outside of its class, that is when you define it.

Member Avatar for mrnutty
0
110
Member Avatar for infern0

>>Would you recommend breaking the order string down? If so how? I guess if you really have to. Here is an example, breakString2 is just breakString1 using loops, see how much space is saved. Anyways, I provided both so you can understand what one function is doing : [code] #include<iostream> …

Member Avatar for mrnutty
0
117
Member Avatar for bpt0004

The distance between two vector is given by (v1-v2).length(); Your return type should be similar to the parameters passed. And welcome!

Member Avatar for bpt0004
0
2K
Member Avatar for gretty

Neither. Its should look something like this : [code] ~LinkedList(){ List * temp = head; while(temp != null){ temp = temp->next; delete head; head = temp; } } [/code]

Member Avatar for gretty
0
80
Member Avatar for PDB1982

>>Is it possible to have them all round out to only two decimal places? First you have to decide if : 1) You want to output up to 2 decimal 2) You want the actual value of the decimal to be 2 decimal places long.

Member Avatar for restrictment
0
112
Member Avatar for walter clark
Member Avatar for sexyzebra19

Try this : [code] double norms(double vectorA_xcomponent, double vectorA_ycomponent, double vectorA_zcomponent, double[COLOR="Red"]&[/COLOR] norm_1) { norm_1 = (vectorA_xcomponent+vectorA_ycomponent+vectorA_zcomponent); return norm_1; } [/code] Change the prototype as well.

Member Avatar for sexyzebra19
0
99
Member Avatar for riu

Sounds like H.W. Try googling it up, and read a couple articles and post what you think the answer should be, and from there we could determine if you got it( from our opinion)

Member Avatar for mrnutty
0
53
Member Avatar for UKmason

change float points (x1, x2, y1, y2) to float points (float x1, float x2, float y1, float y2) also your distance formula is wrong : distance = sqrt(x2-x1) + (y2-y1);[/code] the distance between two points is given by the formula : D = sqrt( (x2-x1)^2 + (y2-y1)^2 )

Member Avatar for mrnutty
0
291
Member Avatar for speedy94519

[code] * * * * * # # # 1 * * * * # # # # 2 ROW * * * # # # # # 3 [/code] realize that there are 5 '*' the 4 '*' then 3 '*' after each line. On the other side, there …

Member Avatar for mrnutty
0
96
Member Avatar for complexcodes

Something like this : ? 1) Create a result list 2) Merge list A and list B 3) copy result list to list A, while making sure that list A has enough add at each insertion.

Member Avatar for mrnutty
0
148
Member Avatar for number87

Use sstream; [code] #include<sstream> #include<string> using namespace std; int main(){ stringstream converter; string str= "3.14"; converter << str ; //put in string float PI = 0; converter >> PI; //put out float return 0; } [/code]

Member Avatar for mrnutty
0
177
Member Avatar for jupitertrooper

how about getting the input as string( or char array if you can't use string). [code] string num = ""; cin >> num; if( validate(num) == false ) //Error ... [/code] Validate function : [code] bool validate(string num) { if( num[0] < '0' || num[0] > '9') return false; return …

Member Avatar for mrnutty
0
341
Member Avatar for UKmason

Not exactly sure if this will help but the equation to a circle is : [code] //Cartesian coordinate X^2 + Y^2 = R^2 //polar coordinate //R = radius sin^2(x)* R + cos^2(X) * R = 1 [/code]

Member Avatar for mrnutty
0
151
Member Avatar for axn
Member Avatar for noey699
Member Avatar for noey699
0
139

The End.