2,839 Posted Topics
Re: You should add some error-checking so that you can discover yourself which part is the problem instead of saying: "doesn't work, please help" Add a line like this for example: [icode]if (!file.is_open()) cout << "file not open";[/icode] to check if the file is still open And to check if the … | |
Re: But this [i]is[/i] the C++ forum after all, so I would suggest a C++ solution rather then a C solution. [code=cplusplus] #include <iostream> #include <string> #include <sstream> using namespace std; void StripSpaces(string); int main() { string str = "hello world with spaces"; StripSpaces(str); return 0; } void StripSpaces(string strin) { … | |
Re: Iamthwee is going to hate me for giving this link, but : [URL="http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_linklist.aspx"]linked lists[/URL] ;) For your particular case, you might need to create a bit advanced linked list because people have a variable number of children ... | |
Re: Also: The temperature in Fahrenheit never get calculated, so you'll have to add a calculation somewhere in you code :) And: [URL="http://www.gidnetwork.com/b-61.html"]system("pause");[/URL] | |
Re: If you're using a C-compiler, it might come from <math.h>. I'm not sure of this, but I vaguely remember that there's a round() function in there somewhere. To my knowledge, there is no round()-function in C++, but I could very well be corrected in the next few replies. | |
Re: and don't forget to [icode]delete [/icode] the memory once you're done with it! | |
Re: My favorite : [URL="http://www.microsoft.com/express/vc/"]Visual Studio 2008 C++[/URL] (free) But also available (free): [URL="http://www.bloodshed.net/download.html"]Dev-C++[/URL] [URL="http://www.codeblocks.org/downloads"]Code::blocks[/URL] | |
Re: [QUOTE=chute20;698402] Dont wanna brag about it but ive got this idea [..blahblah..] or give me a different idea for finaly year coz this is a crap idea.. [/QUOTE] I wouldn't 'brag' about a 'crap idea' either if I were you. First of all: If you're in your final year, you … | |
Re: Since this isn't you whole code, I can't tell what goes where. But I [i]can[/i] give you a snippet: [code=cplusplus] std::clock_t start = std::clock();; int detected = 1; while(1) // this would be your detection loop { if ( /* face detection failed */ ) detected = 0; if ( … | |
Re: [QUOTE=Ancient Dragon;698039]Here is one way to do it. [code] int main() { unsigned char a[4] = {0XBC,0x1e,0x04,0x00}; [color=red] unsigned long n = *(unsigned long*)a;[/color] } [/code][/QUOTE] Nice piece of code. I never knew it could be (legally) done like this. But you're assuming that a long has 4 bytes and … | |
Re: [QUOTE=vijaysoft1;699460]....... experts programmers , help me ....[/QUOTE] What are all those dots? Anyway: Bumping your thread is very impolite. Now I can't speak for all of us, but I personally haven't got a clue what you're asking. You understand the program, but you don't understand the program?? So ask a … ![]() | |
Re: [QUOTE=nichokongo;696484]h i guys, i want to develop a software that can be used to control air traffic.[/QUOTE] You've got to be kiddin'... Are you some kind of lazy-ass terrorist? | |
Re: You'll have to look at the arguments that main accepts: [code=cplusplus] int main( int argc, const char* argv[] ) { if (argc != 4)// program name and 3 arguments { std::cout << "Usage: ./a.out <-e/-d> <FIlename> <Value>\n"; return 0; } //rest of the program return 0; }[/code] If you want … | |
Re: Here's your code USING CODE-TAGS and indention. Notice how readable it is? [code=cplusplus] #include <iostream> #include <ctime> using namespace std; void fillar(int ar[][9], int numRows); void printar(const int ar[][9], int numRows); int howmanyar(int x , const int ar[][9], int numRows); int main() { int userinput; srand(time(0)); int ar[10][9]; fillar(ar, 10); … | |
Re: Do you mean a std::stack? You can just push and pop anything in/out it. It's actually quite simple... [code=cplusplus] #include <iostream> #include <stack> #include <string> using namespace std; void ShowStack(stack<string> in) { while (!in.empty()) { cout << in.top() << '\n'; in.pop(); } } int main() { char s1[] = "I'm … | |
Re: Recursion in combination with file-access is asking for trouble... I'll bet that somewhere the file[i]is[/i] closed or opened without your knowledge :) Could you post the code? | |
Re: Because they are two different things. I suspect you are referring to an error you're getting? Post the code (using [noparse][code] [/code][/noparse] tags) and we might come up with a solution | |
Re: [QUOTE=williamhemsworth;698341][B]Im not*[/B] damn I hate this editing rule :idea:[/QUOTE] Look at the post again: >[I]Last edited by Ancient Dragon : 10 Hours Ago at 11:51 pm. Reason: corrected grammer [/I] Now that's some nice modding :) | |
Re: The line in green causes all your problems. I can't give you a solution (yet), because I haven't got a clue what you expect that line to do :) So enlighten me! ![]() | |
Re: With out seeing the code, it's a wild guess for us to. But I bet that you break out of an array's bounds somewhere | |
Re: Your problem is that std::strings don't support the >> operator. The geline function takes one line out of your input file and puts it in a string, but to break up that string into words, you should use a [URL="http://www.cplusplus.com/reference/iostream/stringstream/"]stringstream[/URL]. Here's the corrected code: [CODE=cplusplus]void input (ifstream& file, int* end, … | |
Re: [QUOTE=marivic;697971]:([/QUOTE] :icon_frown: | |
Re: So you wrote a code that you don't understand? That's funny :) | |
Re: Just remove the line. Alex uses pre-compiled headers in Visual studio, this requires for stdafx.h to be included. Removing the line should solve your prob :) | |
Re: [QUOTE=jproducer;694178] I guess my issue is...What are you "getting"?[/QUOTE] Something from the file :) The teacher means that you'll have to read something from the file in the [ICODE]while !eof[/ICODE] loop. So something like : [code] While not eof read stuff from file do stuff [/code] | |
Re: 'A' shouldn't be too much of a problem, show us what [i]you[/i] think the pseudocode should look like, and we'll tell you if you're right or which part could use some improvement. | |
Re: [QUOTE=ptwoms;694774]I want to develop efficient and optimized Myanmar OCR software that can recognize myanmar characters[/QUOTE] If you want to create this yourself, you might want to learn [URL="http://en.wikipedia.org/wiki/Neural_network"]Neural Networks[/URL] for a while. Be aware that this is a damn hard project for a professional to do be itself, and it … | |
Re: [edit] The line highlighted should actually work. It's ok to assign one std::string to another with the = operator. Looking through your program, I [i]do[/i] see some other issues: [CODE]void getData(ifstream& data, string array[100], int n) { n=0; while(!data.eof()) { data >> array[n]; if(data.peek()=='\n') { break; } n++; } }[/CODE] … | |
Re: [QUOTE=Prathvi;694057]Hi mitrmkar Thanks for your reply. How to copy the TTF to windows\fonts folder.[/QUOTE] - select the file - ctrl-c - goto c:\windows\fonts with explorer - ctrl-v :) | |
Re: It's sounds like that awful 'swapping without using a temp-variable' assignment to me. But then again, with all those abba's, who knows? | |
Re: your missing a '}' in your main. (after return 0; ), but I suspect this is a copy-paste error? Other problem: [ICODE]averageQtrScore(avg,teamscores);[/ICODE] [COLOR="green"]avg[/COLOR] is an int and [COLOR="Green"]teamscores [/COLOR]is a 2d-array of ints. But [COLOR="Green"]averageQtrScore[/COLOR] expects two 2d-arays. I don't know what to change it to, because you never use … | |
Re: Turbo C++ is really outdated... You could try downloading a newer (free) IDE like [URL="http://www.microsoft.com/express/download/"]Visual Studio Express [/URL]or Bloodshed . For your problem: Put a [icode]std::cin.get();[/icode] just before you [icode]return 0;[/icode]. (Or [icode]getchar()[/icode] when using C) Niek | |
Re: First of all, this: [icode]for(i=1; i<=100000000; i++){//its loop time [/icode] is a horrible way to create a 'timer'. You could better use something like: [code=c] #include <ctime> //[...other code..] time_t t1= time(0), t2= time(0); while( (t2 - t1) < 5) t2 = time(0); // here 5 seconds have passed [/code] … | |
| |
Re: How about the 3 topmost threads in this forum... [URL="http://www.daniweb.com/forums/thread128350.html"]Phyton GUI[/URL] [URL="http://www.daniweb.com/forums/thread32007.html"]Beginner projects[/URL] [URL="http://www.daniweb.com/forums/thread20774.html"]Starting phyton[/URL] :icon_rolleyes: | |
Re: I agree with Salem, select() is the way to go. If you want to learn how this function works, look at [URL="http://beej.us/guide/bgnet/output/html/multipage/advanced.html#select"]Beej's guide[/URL] | |
Re: [QUOTE=Jawahar prabhu;693246] you should include complex.h.[/QUOTE] You mean [ICODE]#include <complex>[/ICODE] not [ICODE]#include <complex[B].h[/B]>[/ICODE] | |
Re: [QUOTE=jadedman;691943]hello there! im creating a program with both stdio.h and iostream.h in the include header. Can the program run with them both? or others?[/QUOTE] As Ancient Dragon mentioned: change <iostream.h> to <iostream>. If this doesn't work on your compiler (probably Turbo...), you need to update your compiler to a modern … | |
Re: It's doesn't have adblock (yet), so I'm not installing it. Which is a shame, because now I have to miss [URL="http://img84.imageshack.us/img84/7848/55334208ze6.png"]this[/URL] ps. what JWenting was [URL="http://www.readwriteweb.com/archives/security_flaw_in_google_chrome.php"]talking about[/URL] | |
Re: First question: The user can only input the number of days that they want to look back from the present date/time right? 2nd: Show us how ListDate[i] is declared, how the date is stored, what other data is stored in this (if any) | |
Re: This thread is so old, it saw the creation of the [I]previous[/I] LHC :) | |
Re: My favorite mistake in C/C++ used to be this: [code] if (something [COLOR="Red"]=[/COLOR] 1) { // do stuff } else //something else [/code] And then be like "Why the hell is this always true??". If you had this problem a few times you'll never forget that = != == . | |
Re: Change [ICODE]c1 << Total;[/ICODE] to: [ICODE]c1 << std::setprecision(10) << Total; [/ICODE] And don't forget to [ICODE]#include <iomanip>[/ICODE] for this. [edit]Darn, too slow | |
Re: Let me have a look in my crystal ball.... I think you have an error on line 26, and it probably has something to do with a '%' .... In other words: post the code | |
Re: line 147 calls a function which expects an string as input: [icode] saveRecord(string filename); [/icode] You can't declare a string like that. You could solve the problem in two ways: Change line 147 to: [code=cplusplus] saveRecord("c:\\a_file.txt");[/code] or: [code=cplusplus] string filename = "c:\\a_file.txt"); saveRecord(filename); [/code] Another problem is that you never … | |
Re: [QUOTE=Emerald214;692307]The compiler i use is "Microsoft Visual C++ 6.0 Enterprise Edition" ^^. Please help me >"<.[/QUOTE] As Narue already told you: this is probably a bug in the (old) vc6 compiler. So the solution would be to download something newer, like [URL="http://www.microsoft.com/express/vc/"]Visual Studio 2008 express[/URL] (free) | |
Re: [URL="http://msdn.microsoft.com/en-us/library/aa366597(VS.85).aspx"]HeapAlloc[/URL] Google is not that hard to use... | |
Re: [QUOTE=cat08;692246]Please give me the code as well as the algorithm for the following 3 questions, 1) To generate the following pattern using 'for' loop. 1 2 3 4 1 2 3 1 2 1 1 2 1 2 3 1 2 3 4 [/QUOTE] Give you the code? [URL="http://www.daniweb.com/forums/announcement8-2.html"]No[/URL]. Or … |
The End.