5,237 Posted Topics
Re: > linklist=(list *)malloc(sizeof(list)); This is a C program, and you're casting the result of malloc. You don't need to do this in C. See [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1047673478&id=1043284351[/url] > scanf("%d",linklist->data); 1. You forgot the & 2. it's %c for reading chars, %d is for ints > p1=(list *)malloc(sizeof(list)); On the last iteration of … | |
Re: > i have tiff, but there is several ways to convert on bmp so any suggestions? code snippets? Yet this seems like such a minor issue compared to the other problem you have of recognising blocks of text, and telling them apart from other marks on the image. I guess … | |
Re: > Aug 9th 2004, 12:27 PM You should have waited the full two YEARS before bumping this thread :rolleyes: | |
Re: You normally have to type in ./program_name Rather than program_name For security reasons, most people avoid having "." on their PATH. | |
Re: > I know about the issues involving comparison of double datatypes "This is a hole, and I know I'm lying at the bottom of it." What exactly were you expecting to happen? If you know about the issues, why didn't you code around them and test on each compiler? > … | |
Re: > int integers[0]; Use your constant to set the maximum number of elements in the array > int largest = integers[0]; You can only do this after you've read in some values.... > cin >> integers[i] Your search loop is good. But this too needs to be in a loop … | |
Re: Have you figured out how to sort a 1-D array using your own comparison function, and the standard library qsort() function? It's exactly the same method, the only trick is getting the compare function declared properly. | |
Re: > A reference that is not to 'const' cannot be bound to a non-lvalue > insert(subRoot->getLeft(), key.data); At this point, there is no storage location (an l-value) which to take a reference to. All you have is the value (r-value) of the result of subRoot->getLeft() I would suggest you look … | |
Re: > here it says there is syntax error Because due to your poor indentation, the return statement is actually outside the function. > tree= (node*)malloc(sizeof(node *)); 1. Don't cast the result of malloc in C 2. you have the wrong sizeof - it's the size of the object, not the … | |
Re: You really need to discover the magic of a) indentation b) functions. A 800+ lines of code in main(), c'mon be serious. Nobody is going to wade through that lot just to spot what might be wrong. A rough rule of thumb - if you can't see the entire function … | |
Re: > looking at ur requierment, u can write in swap funtion like What is wrong with using a temporary variable? Not to mention the possibility of data corruption due to whatever way you machine handles arithmetic overflow and underflow. | |
Re: > I want to do the following things in a single program [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] > Help required Did you think of that topic all by yourself? > This very urgent .please help me immediatly. [url]http://www.catb.org/~esr/faqs/smart-questions.html#urgent[/url] | |
Re: > Please help me. It's urgent.... [url]http://www.catb.org/~esr/faqs/smart-questions.html#urgent[/url] [url]http://www.daniweb.com/techtalkforums/thread29300.html[/url] Dredging up long dead threads with pointless "me too" queries won't buy you much sympathy either. | |
Re: Is this in the compiler itself, or in a program you created which has compiled OK, but which crashes when you run it. | |
Re: It isn't even valid C, never mind C++. I don't know which crusty old fossil compiler you're using (but I guess it's Turbo C), but you seriously need to upgrade to something in this century. Here are a bunch of edits just to make the thing compile using a C … | |
Re: Well post your latest effort, and then perhaps we can help you solve the problem. Are you using C-Style char arrays for your strings, or std::string strings from C++ ? ![]() | |
Re: It [b]was[/b] already posted on the C++ forum [url]http://www.daniweb.com/techtalkforums/thread44924.html[/url] Now, it's just a duplicate post. | |
Re: What are you after - vacuous post of the week award? How about including some useful information like - which OS - which compiler - which database(s) - which API(s) Not to mention.... - what have you tried already to solve the problem? | |
Re: > then go ahead and do whatever turns you on, but later on you will probably regret it. I agree, it's just another variation on people learning with say TurboC. Learn the language first, then learn an implementation. | |
Re: Here's a hint: Write a loop which determines the min and max values stored in the array. | |
Re: "but I’m having issues installing." You're expecting to catch the right fish with that bait? | |
Re: > )I'm hoping to learn c++ what's a good book to teach me? First post in the forum is labelled "C++ Books" [url]http://www.daniweb.com/techtalkforums/thread10232.html[/url] > What's good program to use (im looking at making game & programs)? Most people go with dev-c++ [url]http://www.bloodshed.net/dev/devcpp.html[/url] | |
Re: > void main(void) [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044841143&id=1043284376[/url] > gets(text); [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1049157810&id=1043284351[/url] Here's a little program to show the same thing using arrays and pointers [code] #include <stdio.h> int main ( ) { char test[] = "this is a test\n"; char *p; int i; for ( i = 0 ; test[i] != '\0'; i++ ) … | |
Re: So what's the question? How to read the file? One thing to work on is some kind of process table, and 3 functions (doFCFS, doRoundRobin etc) which work on that process table. | |
Re: Introducing the 5-second google search results [url]http://www.horstmann.com/cpp/streams.txt[/url] [url]http://www.boost.org/libs/format/doc/format.html[/url] | |
Re: [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] | |
Re: > and its due to 15 - 4 - 2006 Seems that's not the only thing which has been missed.... | |
Re: It's a pity you didn't format your C code while you were at it :rolleyes: Where's all the indentation to denote block structure, and blank lines to separate one function from another? | |
Re: > The first three people to complete this program will be entered into the annual contest for Top Coder! Seems the best thing to do is to goto the site and verify this. No wait, this is just another "ruse" to get someone else to do your homework isn't it? | |
Re: [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] I see no ships! | |
Re: > if (*fp == NULL) You could start here - never mind the rest of it. Say if (fp == NULL) Man, didn't your compiler complain about that line? > while( fgets(questions[x], sizeof(questions), fp) != NULL) If you lie about the buffer size, then it's no better than gets() Besides, … | |
Re: [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] If you really want people to pay attention to your code. | |
Re: [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] | |
Re: Apparently, I wasted my time :mad: [url]http://www.daniweb.com/techtalkforums/thread43435.html[/url] Not only have you dropped the initialisation of univ in main(), but you've gone back to using fscanf to read the file. Not only that, you're now using global variables like "temp", which get allocated on every iteration of the loop and never … | |
Re: [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] | |
Re: I think the whole point of this exercise is for you to write a function along the lines of [code]void convertToBase( int number, int base, char *result );[/code] Assuming you know how to do this for base 10, through application of the / and % operators, the rest should follow … | |
Re: > version creates 'x' as a const pointer object. When you've finished reading this [url]http://c-faq.com/aryptr/constptr.html[/url] Finish reading this [url]http://c-faq.com/aryptr/index.html[/url] | |
Re: Perhaps you tried to use ^ as "raise to power" and got some very weird answers. What you need to realise is that you need to call the pow() function in math.h, because ^ is the bitwise-xor operator. | |
Re: [url]http://unixhelp.ed.ac.uk/CGI/man-cgi?termios[/url] Clear the ECHO bit. You might also consider [url]http://www.hmug.org/man/3/getpass.php[/url] but I think that's a deprecated function. | |
Re: > My assignment 's deadlin is by tomorrow. the assignment is avl tree. So you've been sitting on the problem for a week, and now you expect someone to save your ass in 24 hours? > I really need the source codes urgently as without it, the whole program would … | |
Re: > stdafx.obj : error LNK2005: "void __cdecl DebugTest(char *)" (?DebugTest@@YAXPAD@Z) already defined in Internet.obj This is what you normally get when you #include one .cpp file inside another, or put actual code (not declarations) inside header files. | |
Re: 1. Please use [code][/code] tags when posting code - see the readme first threads. 2. void main() main returns an int. 3. for(int polygon = 0;polygon < 3;polygon++) This doesn't compile - polygon isn't declared. Try to post what you actually compiled. There's no way for us to guess whether … | |
Re: Ah, I see. It's that new style of CSV file without any comma's in it :rolleyes: Perhaps the fields are separated with a tab character instead. > char matrix_points[6][8]; Perhaps std::string matrix_points[6][8]; would be better for storing things. | |
Re: > char month[13] Try [inlinecode]char *month[12]={"January","Febuary","March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};[/inlinecode] > cout << month << " " << day << " " << year << "\n"; You also need to actually call the function as well, say [inlinecode]printMonth( month );[/inlinecode] | |
Re: > Been trying ot figure out this for couple days but keep getting syntax errors for some reason. Well post what you tried, then perhaps we can lead you to the answer. | |
Re: > void main main returns int > char user_choice; > while (user_choice!='z') This variable is uninitialised at the point you first use it. > university univ; This isn't initialised either. Which is very important when you get to make_file(), since you do - dereference an uninitialised pointer - try and … | |
Re: > properties->settings->advanced->options So I'm guessing you're not using DOS then. So why on earth are you trying to use a DOS compiler then? Do you have a fondness for museums and a longing to be a driver of a steam engine? | |
Re: Try [code]level[i] = cal_Fitness_Level(age[i], sex[i], wTime[i]);[/code] | |
Re: Here's a hint [code] g++ -W -Wall -ansi -pedantic -O2 foo.cpp foo.cpp: In function ‘int main()’: foo.cpp:20: warning: ‘ntemp’ is used uninitialized in this function [/code] Fix the order of assignments to actually swap two variables. | |
Re: > 1010.1010 Well to the left of the radix point, it's 1, 2, 4, 8 (2^0, 2^1, 2^2, 2^3 etc) To the right, it's 1/2, 1/4, 1/8, 1/16 (2^-1, 2^-2, 2^-3, 2^-4 etc) |
The End.