419 Posted Topics

Member Avatar for Chuckleluck

If a file is up one level from the current directory you can use ".." to access its parent directory. So you can write `#include "../main.h"`.

Member Avatar for mike_2000_17
0
16K
Member Avatar for neronero

It sounds like you set up the search directories fine, but doesn't seem like you actually linked the required libraries. Right next to the Search directories tab is the Linker settings tab, click this and then press the add button and add the required libraries to your project (you can …

Member Avatar for Ancient Dragon
0
487
Member Avatar for somjit{}

Your second for() loop is causing the crash because the first for() loop leaves i at a an index with a junk value since it increments then checks to see if ip_num is 0. There are two quick ways to fix this: 1) You can assume that ip_num is never …

Member Avatar for somjit{}
0
175
Member Avatar for dinhpham1991

Show us what you have written so far and we can help you through it if you have any actual questions. Do not just post up a homework assignment and expect someone to do it for you.

Member Avatar for sfuo
0
197
Member Avatar for dan_code_guru

I'm not 100% sure why you are making a 100 element array to hold 24 indices. Also you are trying to treat an array like a function or something, but it is incorrect. There are a few ways of doing this but here is the way I think you would …

Member Avatar for dan_code_guru
0
790
Member Avatar for Panathinaikos22

No matter what, collision detection is just going to be a bunch of if() statements. The way that you prevent checking way more objects than you need to is by dividing all your objects into a [quadtree](http://en.wikipedia.org/wiki/Quadtree) or an [octree](http://en.wikipedia.org/wiki/Octree). You then check if your player is within one of …

Member Avatar for sfuo
0
145
Member Avatar for Mbot

If you use [atan2](http://www.cplusplus.com/reference/clibrary/cmath/atan2/)(y,x) it handles divide by zero and what quadrant the angle lies automatically.

Member Avatar for Mbot
0
151
Member Avatar for KungFuTze

First of all what scope is your gradebook[][] array declared in? Try putting this for your Modif() function: [CODE]void *Modif (double gradebook[][9], int Students)[/CODE] Not 100% sure if that will even do anything but I think it might change your array.

Member Avatar for Stephen Ayayo
0
2K
Member Avatar for mayank.dyl

If you think about it you can divide by just using subtraction and a for() loop. Since you have this function itoa() available I'm assuming you are only using integers, which means you do not have to worry about remainders/decimals. Not gonna give you any code because you clearly just …

Member Avatar for mayank.dyl
0
309
Member Avatar for ChrisMackle

I have attached a rewrite of your program because if you ever want future help your code has to be structured. I would recommend having main.cpp with pretty much just main() in it so you can read the flow of the program and if you want to know what happens …

Member Avatar for sfuo
0
511
Member Avatar for abhimanipal

itoa() is in <cstdlib> but is non-standard (meaning it is not implemented by all compilers). [This](http://www.cplusplus.com/reference/clibrary/cstdlib/itoa/) page shows an example of an alternative method using sprintf(). I'm pretty sure you could also use stringstream.

Member Avatar for mike_2000_17
0
2K
Member Avatar for piyush3dxyz

As far as functionality goes it works; however, you shouldn't be using labels/gotos because they are a bad coding habbit and make reading the flow of your code harder. Anywhere you use a goto statement you can replace it with a loop (which is what I did in this case). …

Member Avatar for sfuo
1
12K
Member Avatar for wazzanee

Show us that you have done some work on this by yourself. Post up a program that creates an array, fills it (either hardcoded or by user input) and then your attempt at removing duplicates. After that I will be able to help you out, otherwise you will learn nothing.

Member Avatar for wazzanee
0
138
Member Avatar for 24x24

On line 11 your function prototype says that approximateSqrt() takes no parameters so that is where that error is coming from. To fix it change that line to `double approximateSqrt(double);`

Member Avatar for 24x24
0
217
Member Avatar for compsci91

On line 6 you want to use "rb" not just "r" because just using "r" would read one character at a time. If you have a bunch of integers in your file that are two digits long but are represented as 4 bytes you will be reading only two characters …

Member Avatar for sfuo
0
163
Member Avatar for dark_sider_1

Where is your `gluPerspective()` call? Since I don't see where you are positioning the "camera" or "viewer" you might not have the correct far value.

Member Avatar for mike_2000_17
0
979
Member Avatar for Lama1

Why don't you show us your code for a linked list and your attempt at getting min, max and counter functions to work.

Member Avatar for sfuo
0
31
Member Avatar for rayden150

5050 is the sum of the numbers from 1-100. You are printing the value returned from counter in main() so it will only print once. If you want to print all the numbers from 1-100 you should have your print statement within the recursive function and you do not need …

Member Avatar for siaswar
0
297
Member Avatar for thecoolman5

You should really start a new thread for new questions since this is a really old thread. To find a char in a string you can use the find() member of the string class and get the index of it. example: [CODE]#include <iostream> #include <string> using namespace std; int main() …

Member Avatar for eddiecrosby
0
4K
Member Avatar for thecoolman5

Your code will not enter the inner for() loop because you have [ICODE]c = 0[/ICODE] right before it and your condition is when [ICODE]c > 0[/ICODE].

Member Avatar for thecoolman5
0
270
Member Avatar for YourGamerMom

You don't have a display function or an idle function. Not 100% sure if this is the problem since I haven't used glut in a while but from what I remember you need them.

Member Avatar for YourGamerMom
0
338
Member Avatar for sameerge

Try starting with this [CODE]#include <iostream> using namespace std; void MyFunction() { //does something } int main() { MyFunction(); return 0; }[/CODE]

Member Avatar for Narue
0
1K
Member Avatar for Karlwakim

The variable ans is initialized but not set. Right before your for() loop you should write [ICODE]ans = num;[/ICODE] otherwise ans will just have a garbage value in it. [B]EDIT[/B] Or you can change line 7 from [ICODE]cin >> num;[/ICODE] to [ICODE]cin >> ans;[/ICODE].

Member Avatar for Karlwakim
0
135
Member Avatar for hamby

Like VernonDozier said, you are declaring 'char c' out of scope but there are also a few other errors within your program. You are calling the function srand() at the start of the for() loop on each iteration which results in all the characters being the same. The solution to …

Member Avatar for hamby
0
191
Member Avatar for communism

The function is not bugged you just didn't read the documentation on this function. The way you have it set up you have two major problems. #1 left and right values cannot be equal #2 near and far must be both positive If you were to write out the resulting …

Member Avatar for communism
0
297
Member Avatar for Chuckleluck

Best way to figure these types of problems out is by using some paper. Draw each case you want on paper (in this situation you want to see four ways another box can hit the "hittee") then write out the conditions that have to be met. Also what happens if …

Member Avatar for Eagletalon
0
215
Member Avatar for dakerao

If you do not want the background to move then you will have to draw it first then translate the rest of your scene based on the position of your camera or whatever is moving right now. If you want the background to go forever and move it then you …

Member Avatar for sfuo
0
147
Member Avatar for Danizand

If you wanna do a quick n dirty transpose on output just switch your i and j values when printing out. From [ICODE]out[i][j][/ICODE] to [ICODE]out[j][i][/ICODE] will output the transposed matrix assuming that it is a square (#rows = #cols). If you don't know if #rows = #cols then you do …

Member Avatar for Danizand
0
2K
Member Avatar for Rass Saee

I haven't really touched C# before but I'm pretty sure (since in C++ you have to) you need to have BaseClass as an abstract class and then declare someMethod() as abstract within it. This is because you are trying to call a function in SubClass when BaseClass has no idea …

Member Avatar for berniefitz
0
122
Member Avatar for terence193

I take it you want to make a multi-dimensional array so you can store all the words into one array and then use a for() loop to populate/sum the values. You can merge the two for() loops into one but if you were to join them then why take the …

Member Avatar for sfuo
0
108
Member Avatar for Sphiros O'kelli

For the most part the code is pretty good. You made a few minor errors that would be expected since you are still starting out but you should really work on consistency in indentation since it is harder to read and edit (you will really notice this later on) so …

Member Avatar for Sphiros O'kelli
0
344
Member Avatar for metronomu

Without actually knowing how it is implemented and by only playing around with these two classes it seems when there is a name conflict (in this case x) the default scope to be used is that of the class that is calling it. When inheriting another class the class that …

Member Avatar for metronomu
0
138
Member Avatar for astrolegacy

Start with "Hello World!" then add to it. Then come back and as for help when you have something to show.

Member Avatar for WaltP
0
252
Member Avatar for spicyrelish

A quick solution to what you want is to just move your topping selector to the Pizza class since you pretty much have a circular reference with your derived class sitting inside of your base class. I threw together a simplified version of what I think you are trying to …

Member Avatar for sfuo
0
172
Member Avatar for dionisov

After fixing a bunch of typos and added to the bottom of Advanced2D.cpp (you have the extern prototypes but you do not actually make the functions) [CODE]bool game_init(HWND in) { return true; } void game_update() { } void game_end() { } bool game_preload() { return true; }[/CODE] Make sure you …

Member Avatar for apneweb
0
266
Member Avatar for nuclear

He sets it to NULL (or 0) because that way he doesn't reprint the same message constantly. Whenever you press a key message becomes non-NULL and it redraws and this has nothing to do with the program quitting.

Member Avatar for raptr_dflo
0
488
Member Avatar for pendo826

Did you figure the problem out? I see it is marked as solved but you didn't edit your post or post your solution. The problem I see is that you are missing an if() to go with your bottom else statement.

Member Avatar for pendo826
0
138
Member Avatar for PixelExchange

If this is all the code you have for your DC and drawing then the problem is that you aren't drawing to the correct DC that you might think you are. In WM_CREATE: you are creating an HDC object and then setting it to the current DC. After this case …

Member Avatar for PixelExchange
0
97
Member Avatar for Jackk123

rand()%RAND_MAX should generate [0,32767) meaning the number will never be 32767. If you want it to include 32767 then just use rand()%(RAND_MAX+1).

Member Avatar for Jackk123
0
146
Member Avatar for liquidmonkey

A normal is a vector and the dot product returns a scalar. To calculate the normal of a plane when you know two vectors along that plane then you use the cross product (because it gives a vector perpendicular to the plane aka the normal). The equation of a plane …

Member Avatar for sfuo
0
70
Member Avatar for Jsplinter
Member Avatar for Jsplinter
0
281
Member Avatar for amitshree

Based on what you posted you have just made your prototypes but you have not actually defined any of the functions.

Member Avatar for amitshree
0
170
Member Avatar for tyricec

The issue lies within your function gasket(). On line 34 you are missing an equals sign between point and T, so it should look like [CODE]GLPoint point = T[index];[/CODE] Then when you are adding point.x and t[index] then dividing by 2 you really want to add each component then divide …

Member Avatar for tyricec
0
945
Member Avatar for karmstrong

It looks like all your errors/problems are in "cdrom.cpp". In the function CDROM::setName() you have [ICODE]getline(cin, name)[/ICODE] being printed out in your cout statement. The function getline() returns *this which is a pointer to the istream object being used (I think, either way this is not what you want). Also …

Member Avatar for karmstrong
0
174
Member Avatar for maybnxtseasn
Member Avatar for techyworld
Member Avatar for Mouche
0
167
Member Avatar for cypherscouter13

Your function prototypes are different than your function definitions. In the prototypes you are expecting a pointer to a vector where in the definitions you are expecting the reference of that object.

Member Avatar for sfuo
0
267
Member Avatar for cijeh90

Funny thing is that you just copy pasted your assignment without even posting assignment #3 which is referred to in this one. Post what you have so far (and not the original assignment #3) and say what you need help with.

Member Avatar for azwan91
0
313
Member Avatar for johnnyboyslim
Member Avatar for johnnyboyslim
0
199
Member Avatar for shawn.reynz

It's not so much about we don't wanna give you the answer without you putting any thought into it, but the fact that you won't learn anything and you will probably be asking the same question around this time next year. Give it a shot and there are people that …

Member Avatar for sfuo
0
96

The End.