257 Posted Topics
Re: The program seems to be fine. Except that, the variable index in line number 26 wasn't initialised to 0(but was used to index an array). It works fine after that change. | |
Re: This would be: [CODE]ptr->p->i = 3; So, --(ptr->p->i) = 2;[/CODE] So, a[2].z is what is being printed. Which is, "Jabalpur". | |
Re: Did you try [URL="http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_linklist.aspx"]this[/URL]? It is by a member of Daniweb(guess who) :) And i feel it's really good. | |
Re: [QUOTE]Don't be confused... <dos.h> and <iostream.h> are libraries, part of my C++ and C Compiler. I used <dos.h> because it is required by my void printtime() subroutine. (Required for printing the system time in my program.) The <iostream.h> is used for Input-Output streaming function things. (Never mind the iostream.h, anyway. … | |
Re: Initialise low1 and low2 to a high value. Check [URL="http://www.cplusplus.com/reference/clibrary/climits/"]this[/URL] I just had them as 9999(all other numbers in the list were lesser than that.) and it works fine. Here is the [URL="http://ideone.com/gTwqQ"]working code[/URL]: PS: Kindly format code the next time you post. It will be easier to read. :) | |
Re: Well, how does the tutorial read the vertices? While creating the display list, it would be making vertex calls right? Maybe you can open up the code that does that and check how it is done? | |
Hello all, I am a little confused about .lib and .dll files. I always thought that .lib files refer to a static library and that a .dll is the dynamic library. Recently, i read that .lib files also act as a stub for a .dll and that the .lib files … | |
Re: Welcome to Daniweb :) Well, you can use a string comparison function. Use strcmp() if allowed or write your own version of it. In this: [CODE]while (fscanf(prabuinputfile, "%s %s %lf %lf \n", &Try.date, &Try.curr, &Try.buying, &Try.selling) !=EOF ) { // Add if condition here. } [/CODE] So, do a string … | |
Re: [CODE] int x; // Not initialising x and y. int y; int x1; int y1; int x2; int y2; int x3; int y3; int x4; int y4; x1 = x; y1 = y; x2 = x +100; y2 = y; x3 = x; y3 = y + 75; x4 = … | |
Re: Could you show the projection matrix that you have setup? | |
Re: Maybe use command line arguments, read a file using it? [URL="http://www.cprogramming.com/tutorial/c/lesson14.html"]LINK[/URL] | |
Re: >> Guyz please give me some project ideas for my main project. It would be easier to provide help if you mention what interests you and on what topic you would like to do your project on. | |
Re: I'm not sure what you're trying to do here. In case you are trying to convert a string into an int, this would work: [CODE]l = l * 10 + (number - '0');[/CODE] So, when the loop terminates, [B]l[/B] will have the integer needed. By the way, what is [B]cislo … | |
Re: @OP [QUOTE]i realised that i need to learn even more about c++ before setting out to explore the graphics..[/QUOTE] Not really. You can use C. OpenGL has bindings for several languages. Take a look at [URL="http://www.opengl.org/resources/bindings/"]THIS[/URL] | |
Re: What do you mean by [B][I]complete error checking after a user input from the keyboard[/I][/B] ? Could you give an example? | |
Re: >>Compare 2 files helppppppp That does not tell us much about what problem you are facing. Help can be provided only when you tell us what the problem is. PS: [B]#include<iostream.h> -> #include <iostream>[/B] (why iostream anyway?) [URL="http://members.gamedev.net/sicrane/articles/iostream.html"]LINK[/URL] What compiler are you using? Also, [B]void main() -> int main(void)[/B] | |
Re: It is because of this: [CODE]glutIdleFunc(display); [/CODE] display() is being called continuously, since you have registered it as the idle callback. The window does move. The problem is there are too many idle calls. Give some delay, that will work. PS: Its not a good idea to register the display … | |
Re: Where exactly are you reading a string? [B]getc[/B] is used to get a single character. You can try using fscanf() instead, and obtain a string. i hope this helps. | |
Re: @Soubhik Check [URL="http://en.wikipedia.org/wiki/OpenGL"] THIS [/URL]out. Hope that helps. | |
Re: 1) To do object tracking, you can use OpenCV (an image processing library built using C++). 2) To simulate mouse events, you can go for OS specific functions. For example, on Windows, SetCursorPos() to set the cursor position in screen coordinates. | |
Hello everyone, i'm having some problem with the following code: [URL="http://pastebin.com/KTKaVje8"]CODE[/URL] inputSouce is an abstract class and the rest are derived from it. The definitions for these are elsewhere. Now, [CODE]inputSource *irSources[4]; irSources[0] = new irSource(); [/CODE] This is giving me errors. i'm using VS2008. [B]error C2466: cannot allocate an … | |
Re: @OP Do you mean you want to read a file into a char array? That is what your title suggests. Is there a typo error? [CODE]while (not_end_of_file) { read character into array } [/CODE] You can use fgetc() (other ways possible too) to read a character from the file. PS: … | |
Hi, I had to do an experiment regarding the following (1) Setting up a linux box to work as a frame forwarding device, packet forwarding device and packet/frame filtering device. (2) Install public domain routing softwares on linux box so that it can become a router..a linux router. Can I … | |
Re: im not sure why you were doing this: [CODE]quotient = x / hexa;[/CODE] To convert from decimal to hex, try this: [ICODE] 1) Note remainder when divided by 16( i mean num modulo 16). 2) Divide number by 16(integer division) 3) Repeat steps 1 and 2 till you obtain a … | |
Re: You can try using the [URL="http://www.boost.org/"] Boost [/URL]library. And[URL="http://www.quantnet.com/cplusplus-multithreading-boost/"] here [/URL] is an introduction to multithreading using Boost. | |
Re: >>[B]I first need to know how to split a string like "abcd" into a b c d separately[/B] Why don't you use an index? What i mean is, [CODE]char letterArray[100]; for (i = 0; i < strlen(str); i++) { letterArray[i] = str[i]; }[/CODE] | |
Re: Well, to work in screen co-ordinates, you will have to use glDrawPixels. But it is really suggested that you do not use it. If i understand you correctly, you mean you want to directly draw a line on the screen in terms of pixels right? i doubt there is a … | |
Re: >>i just downloaded qt Did you download Qt Creator(the IDE)? | |
Re: Well by table, do you mean a 2D matrix? or a graphical table? with rows and columns? Please elaborate. | |
Re: If you're looking for tutorials on OpenGL, [URL="http://nehe.gamedev.net/lesson.asp?index=01"]this[/URL] is a good one. | |
Re: The [B]while (contReset=='n'||contReset=='N');//and this[/B] part comes in the end: [CODE]int main(void) { do { // this is where you had typed [I]this is the problem loop[/I] // code here } while (contReset=='n'||contReset=='N'); // here is where it needs to be. return 0; }[/CODE] | |
Hello everyone, Well im currently going through OpenScenGraph. i could not understand this piece of code: [CODE]class OSG_EXPORT Group : public Node { public : Group(); /** Copy constructor using CopyOp to manage deep vs shallow copy. */ Group(const Group&,const CopyOp& copyop=CopyOp::SHALLOW_COPY); META_Node(osg, Group); ... // code coninues };[/CODE] Now, … | |
Re: If you are looking for just basic 2D shapes, i guess GDI would suffice: Take a look at [URL="http://www.functionx.com/win32/Lesson11.htm"]this[/URL] | |
Re: Line 11 to 16 [CODE] //display result for (i = 0; i < 2; i++) { printf("\n"); for (j = 0; j < 2; j++) { printf("%d \t", result[i][j]); } }[/CODE] i ran the code, the above changes seem to work | |
Re: Well, could you post what is your requirement? and what was told to be "intense" in your code? | |
Re: Try this: [CODE]#include <stdio.h> #include <math.h> double outputAbsoluteValue (double*number){ *number = fabs(*number); return *number; } int main(void){ double myNumber = 0.0; double absValue = 0.0; printf("Enter Real Number: "); scanf("%lf", &myNumber); absValue=outputAbsoluteValue(&myNumber); printf("\n Its absolute value is %f", absValue); getchar(); return 0; }[/CODE] 1) int main(void) 2) %lf as the … | |
Re: How about this approach: [ICODE] Project(Main Task) | ----------------- | | Code for task 1 Code for task 2 [/ICODE] You can try this, instead of actually compiling two programs separately and trying to call one from the other. | |
Re: Could you paste you code here? | |
Re: Could you elaborate a little more? What do you want to do? Allocate memory dynamically? Use [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/malloc/"]malloc[/URL] | |
Re: [B]>> later we have to find which is the storage format like 4:4:4 or 4:2:2 or 4:2:0..[/B] What do you mean by that? Can you elaborate a little. Here is a list of [URL="http://en.wikipedia.org/wiki/Image_file_formats"]image formats[/URL] | |
Re: [CODE] a == 100;[/CODE] This condition is not satisfied in the first iteration. So, the loop is terminated. outside, c = 1 [CODE](c == 25)[/CODE] So, even this condition is not met. | |
Re: Well you can try this: [CODE] while (count != required_line) { getline(----); // appropriate arguments count++; }[/CODE] [URL="http://www.cplusplus.com/reference/iostream/istream/getline/"]getline[/URL] And i agree with MosaicFuneral. Post whatever code you have already written | |
Re: Welcome to Daniweb. [CODE] graphic_choice( char x )[/CODE] This could be the problem(line 172). Try this [CODE]char graphic_choice( char x )[/CODE] | |
Re: [CODE]#include <iostream> using namespace std; int main() { cout << "7 + 3 = " << 7 + 3 << endl; cout << "7 - 3 = " << 7 - 3 << endl; cout << "7 * 3 = " << 7 * 3 << endl; return 0; } … | |
Re: Post what errors you are getting. Also, indent the code using [ CODE ] tags, or just highlight the code with the option provided. Its hard to read unindented code. | |
Re: What will the contents of the file be like? You can try something like this: i assume they are on new lines. So, is it 4bytes, separated by a newline character? So, you can read 4 bytes. Read it into a buffer. say unsigned char buff[4]; Now, check for your … | |
Re: [B]>>Each record is for a company with the following fields:[/B] It would be easier to help if you paste the relevant code here. EDIT: @alexchen. Sorry, i didn't see your post. | |
Re: Well, i have not used pthreads much. [CODE]pid = fork();[/CODE] This does not create a thread. It creates a child process. You maytake a look at [URL="http://homes.dsi.unimi.it/~boccignone/GiuseppeBoccignone_webpage/MatDidatSOD2009_files/pthread-Tutorial.pdf"]This[/URL] | |
Re: [B]>>how to write this program[/B] Take a pen, write it. Sorry to be rude. But please show some effort from your side. Its not fair on your part to just post a question like that and expect answers to show up. Paste whatever code you have written, or whatever ideas … | |
Re: Well, in this case, there is no difference. By default, floating point literals are double precision. So, 1.5 is double by default. Check this out: [url]http://babbage.cs.qc.edu/IEEE-754/Decimal.html[/url] Thus, 1.1 != 1.1f So, [CODE]const double f1 = 1.1F; const double f2 = 1.1; [/CODE] Here, f1 != f2 (which can be seen … |
The End.