257 Posted Topics
Re: > I want to know if any such 2d game requires an IDE to compile or execute it succesfully? Using a modern IDE would definitely be a good way to go since you have a lot of options with them and your life would be much easier. (if this is … | |
Re: Hi, Firstly, convert your [number into a string](http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/). Then check if it is a palindrome. Also, paste code that you have already tried. | |
Re: >Can someone help me on how to approach this program? I'm really lost. Any help is appreciated. have you tried giving it a shot? Anything at all? If yes, please post it here. If not, here are some thoughts that might help solve it. We can think of an optimal … ![]() | |
Hi All, This is a continuation of the [thread](http://www.daniweb.com/software-development/c/threads/434701/sizeof-operator) where there was an interesting discussion about interviews. Well, firstly, since in this forum, there are a lot of professionals here, and a lot of students who face interviews i felt we could have a thread dedicated to discussing about interviews. … | |
Hello All, Kindly move this thread to an appropriate location. I apologize for the inconvinience. But, lately, (i guess last 15 days i suppose). I have crashes in Mozilla Firefox(details provided below). And the weirdest part is, in my crash report, all say: **Just switched tab to DaniWeb** I am … | |
Re: @deceptikon, Bob Now that we are discussing about questions in interviews, i am curious to know what kind of questions do you generally see people asking? As far as i have seen/heard many interviewers tend to ask things that you would find in any book. I mean something related to … | |
Re: Line number 13 and 15: you have missed an "&" See [scanf](http://www.cplusplus.com/reference/clibrary/cstdio/scanf/) Also, there are some other things i would like to mention: 1) # include<conio.h> --> Not standard C header 2) void main() --> Should be [int main](http://www.daniweb.com/software-development/cpp/threads/78955/void-main-vs-int-main) 3) clrscr(); and getch(); : Again, not standard. | |
Re: > I have just started getting into SFML and Visual studio as well Good. TC is quite old. New IDEs are way better on so many levels. >Q1. What is 'sf' ? Is it a class ? It is a [namespace](http://www.cplusplus.com/doc/tutorial/namespaces/). >Q2. Why is the operator '::' being used here … | |
Re: @OP: Quoting deceptikon: > Fix that and then trace through the execution in a debugger Did you try what he suggested? Do you not have a debugger? AFAIK, even very old IDEs come with a debugger wherein you can add watches and do some debugging. In the worst case that … | |
Re: Hi, `string::const_reverse_iterator rit = s.rbegin();` This should be outside the loop(just before the loop). You are creating a new iterator everytime you enter the loop. PS: This might be an interesting read: [Scope of variables](http://aelinik.free.fr/c/ch14.htm) | |
Re: Hi, try using [strerror](http://www.cplusplus.com/reference/clibrary/cstring/strerror/) to get some more details as to why you're fopen() seems to fail. | |
Re: > so far i have derive the algo and the pixels...but i don't know how to draw a line between those pixels Hi, OpenGL doesn't directly deal with pixel space. What i mean to say is, the API doesn't have functions to directly draw a line between two pixels. However, … | |
| |
Re: Oops, sorry, I posted wrong. @Admins: Please delete this post | |
Re: [Click Here](http://www.daniweb.com/software-development/cpp/threads/78223/read-this-before-posting-a-question) | |
Re: Use of goto is not advised. Have a look at the "Criticism and decline" section on the below link. [url]http://en.wikipedia.org/wiki/Goto[/url] | |
Hello All! To check for return values from a function and setting error flags, i am currently using the following approach: bool fine = true; fine &= func1(); fine &= func2(); .. and so on. if (!fine) { // error } Could anyone please let me know if there is … | |
Re: Do you need to make a GUI for that? take a look at this: [Qt](http://qt.nokia.com/products/) | |
Re: @OP: How about using [sscanf()](http://www.cplusplus.com/reference/clibrary/cstdio/sscanf/)? you can trying something like `sscanf(buffer, "%d:%d", &a, &b); // where buffer is your string` So, you can check the return value of sscanf(). If it returns 2, then it means your string had the necessary pattern. So, you can directly parse and read pattern … | |
Re: Post whatever you have tried. **Here is a hint**: you can use linear search.[but that would return the first occurance of your character though]. So, if your string is joohn, then 'o' would still return 1. | |
Hi all! This is w.r.t the thread [How to make my C++ program executable on other computers](http://www.daniweb.com/software-development/cpp/threads/431194/how-to-make-my-c-program-executable-on-other-computers) I didn't want to continue the discussion there, so i created the new thread. I had faced the same problems in the past. I needed some clarification on the following: 1)`The option shown … | |
Re: > But I had no success. I get a bunch of errors and warnings Could you post them here? | |
Re: I'm not sure i follow you completely. Do you want to use a game engine[that maybe provides an editor of some sort] to create a game? OR Do you want to see the internals of the game engine? Anyway, here is a list of game engines. Some seem to have … | |
Hello All! Well this is not exactly a C++ question. Please let me know if this needs to be posted elsewhere. So, here it goes: I have a project, cosisting of the entire buildrules in Makefiles. This has been built only on Linux. Now, i need to build it on … | |
Hello All! I am a little confused about the memory allocated for an executable. Now, say for example, this is my code: int foo = 1; int main() { const char* bar = "hello world"; int num; return 0; } Now, the "hello world" part would be stored in the … | |
Hello All! I was just wondering if C++ classes could internally be represented in the following way: #include <stdio.h> struct A { int a; void (*ptr) (A *); }; void display(A *ptr) { ptr->a = 2; printf("ptr->a = %d", ptr->a); } int main() { A obj; obj.ptr = display; obj.ptr(&obj); … | |
Re: Hi, If i understand you correctly, this is what you want: You want to scale an object based on the mouse drag. i.e if the mouse is moved away from the object, you scale it more, and when you move closer to it, scale it less. Is that what you … | |
Re: > I am trying to create a MS word file using c programming I'm not sure i understand your question. Do you want to create a text editor? and one that runns on an embedded device? | |
Re: > I want to make use of pointers, I am new to C so don't know how to go about it Have you read about pointers? If not, get a good book, read about it. The forum lists a lot of good books on C. In case you still have … | |
Re: Can you please elaborate what the problem is? I am able to get squares one on top of the other. I have attached a screenshot, and i don't see the black screen you're referring to. | |
Re: @OP Objects are generally specified in a **Local Coordinate System**. The ModelView Matrix transforms the objects into the **World Coordinate System**. This link maybe helpful to you: [Link](http://www.opengl.org/wiki/Vertex_Transformation) | |
Hello. i was trying to solve this problem: [B]You’re given an array containing both positive and negative integers and required to find the subarray with the largest sum (O(N)). Write a routine in C for the above. [/B] i was able to find the largest sum. However,i had little trouble … | |
Hello, I'm trying to use the compiler optimizations for GCC 4.3.3. I used the following [URL="http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html"]LINK[/URL]as a reference. I'm mainly using the O2 and Os levels of optimizations. Could anyone please let me know if the order in which the options matters? Thanks in advance! | |
Re: You mean an application that includes all 3D functions? You would need a 3D graphics API like OpenGL or DirectX. There are several APIs built over these(at least over OpenGL) that simplifies a lot of things. For eg: OpenSceneGraph. So, you would basically need a good 3D API. | |
Hello! I have a sample application. I just put a breakpoint at the beginning of main(). The callstack pointed to a function called mainCRTStartup() and before that, the kernel32.dll was present(grayed out). Can anyone please tell me what these functions are, and who invokes them? Thanks in advance! | |
Re: You seem to be missing the main() function. Is it in another file, included in your project? | |
Hello everyone, I came across the following in a book: [CODE]Keyword typename The keyword typename was introduced to specify that the identifier that follows is a type. Consider the following example: template <class T> Class MyClass { typename T:: SubType * ptr; ... }; Here, typename is used to clarify … | |
Re: Well the first thing is to decide an API to program with. OpenGL and Direct3D are mostly used for 3D rendering, not much for 2D(although you can do it). i don't know if you there are 2D specific graphic APIs. There are loads of material available on OpenGL. 1) [URL="http://nehe.gamedev.net/"]NeHe[/URL]: … | |
Re: You can loop through [B]argc [/B]and read values stored in argv[]. [CODE]for (i = 1 to argc) { read file argv[i] }[/CODE] You could do something like that. [URL="http://www.crasseux.com/books/ctutorial/argc-and-argv.html"]argc, argv[/URL] | |
Re: Are you sure [B]SOIL_load_OGL_texture()[/B] is returning successfully? Also, have you specified the correct texture coordinates while drawing the shapes? [QUOTE]] but I still can't get the image to upload.[/I] [/QUOTE] Could you take a screenshot of the output and post it here? | |
Re: "Glow an LED" is too vague a description. You need to provide more details. I had worked on such boards once. There, sending a 0 bit to the LED used to glow the LED. In your case, assuming sending a 0 to an LED glows it, this is what you … | |
Re: You have the following errors. 1) No [B]using namespace std[/B] or [B]std::[/B] (for cout, string etc) 2)[B] void InputData(string, int[], int &);[/B] This function seems to take a string, but you are passing a string array here: InputData(playerNameAr, scoreAr, numPlayersAr); --> Line 25 3) Line 34 -> There is a … | |
Re: 1) [CODE]int n = SIZE ; [/CODE] That should be just before the loop, and initialised to SIZE - 1. 2) You don't seem to change front and rear, thus the termination condition never reaches. 3) A queue is a FIFO(First In First Out) data structure. What you are doing … | |
Re: Try using [URL="http://www.cplusplus.com/reference/clibrary/cstdio/fprintf/"]fprintf[/URL]. You need to start with some code. Here, we can provide help after you have made an effort. Post what you have already written(if you have) or else, read about FILE I/O in C, and if you have doubts, you can post here. | |
Re: You need to generate a texture ID, as you have mentioned. [URL="http://www.opengl.org/sdk/docs/man/xhtml/glGenTextures.xml"]glGenTextures()[/URL] You need to specify the data for the texture. [URL="http://www.opengl.org/sdk/docs/man/xhtml/glTexImage2D.xml"]glTexImage2D[/URL] You then need to specify the filtering technique you wish to use. [URL="http://www.opengl.org/sdk/docs/man/xhtml/glTexParameter.xml"]glTexParameter[if][/URL] You also need to specify the texture coordinates using glTexCoord2[df] You can look into this … | |
Re: [B]count [/B]holds the count of the digits in the binary number. for eg consider 101. 111 -> count = 3. b[0] = 1 b[1] = 2 b[2] = 4 c[0] = 1 * 1 c[1] = 0 * 2 c[2] = 1 * 4 Therefore, sum = 6. PS: What … | |
Re: Well, first up, try to read contents of the file into whatever data structure you are required to use. [URL="http://www.cplusplus.com/doc/tutorial/files/"]File I/O[/URL] | |
Re: I'm not sure if standard C has any functions that do this. [URL="LINK"]LINK[/URL] You can try to use some compiler and OS specific functions, but that would reduce portability. | |
Re: Hi, How about this approach: Convert the array into an integer after parsing through the entire number. i.e say for eg, the number is stored as [B]123.456[/B] Now, find the integer equivalent by looping through the array, i.e obtain 123456 and then, divide it by an appropriate power of 10 … | |
Re: [QUOTE]i dont have idea what string function must be used to find consecutive characters . example is the word commit it will output the letter m[/QUOTE] Your question is not clear. What do you mean to say consecutive characters? The example you gave does not explain the problem well. |
The End.