15,300 Posted Topics
Re: maybe you included the same header file more than once and left out the code guards. | |
Re: >>Can you please suggest me a way to remove this error? Don't do that. | |
Re: why would you want to return some integer instead of true/false? If bool is inappropriate for that function then just change the return type of the function. | |
Re: Learn to use your compiler's debugger and step through the code one line at a time so that you can see what it is doing. line 292: you are attempting to treat a 2d array of REALIZATION structures as if it were a 1d array. It needs two stars, not … | |
Re: I assume you mean you want the file to look somethng like this: [code] 1 2 3 4 5 6 7 8 9 [/code] just create a loop to count from 0 to 2 and use fout to save each matric element. After the third element is written then write … | |
Re: [URL="http://lmgtfy.com/?q=how+to+write+windows+batch+files"]try this[/URL] | |
Re: You can read about my reasons [URL="http://www.daniweb.com/newsletter/2007-05-01.html"]here[/URL]. Browse around the other archive articles and you will find many other members and their reasons. | |
Re: After a little testing I don't think its possible to prevent someone from closing the console window. I tried the code below with vc++ 2008 Express, but it doesn't work because SetWindowLong() returns 0 and the windows error message is "Access is denied". I assume its a permission thing. [code] … | |
Re: setprecision(2) [code] #include <iostream> #include <iomanip> using namespace std; int main () { int c; cout << "Celcius: "; cin >> c; cout.setf(ios::fixed); cout << "Fahrenheit: " << setprecision(2) << (((float)c*9.0)/5.0)+32.0 << '\n'; return 0; } [/code] | |
Re: The problem is more than likely dlls. Check your compiler's installation directory to see if it has the DLLs that you need to install on other computers. Also make sure you compile your program for release mode and not debug. | |
Re: Do you mean the assembly instructions rshit and lshift? The C equivalent are << and >> operators [code] int a = 123; int b = a << 1; // left shift by 1 [/code] | |
Re: argv is an array of character arrays so you can't use the > operator to compare a character array with a std::string. What you need to do is 1) junk should be an int, not a std::string 2) use [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/strtol.html"]strtol()[/URL] to convert argv[is] to an int then compare the two … | |
Re: [QUOTE=arshad115;822248]o yes,it is "stdio.h". what i have learned is that we donot use ".h" in VC2008 like : i use "iostream" not with ".h"[/QUOTE] That's not really correct either -- there are thousands of header files with .h extensions used in c++, such as windows.h because there are no equivalent … | |
Re: what is num ? It needs to be either double or float ([URL="http://www.cplusplus.com/reference/clibrary/cmath/sqrt.html"]link[/URL]). If it isn't then typecast it to one of these. | |
Re: There are two versions of getline() -- one for character arrays and the other for std::string. If variable colour is a character array then use [icode]cin.getline(colour, sizeof(colour));[/icode], otherwise if colour is a std::string then [icode]getline(cin, colour);[/icode] | |
Re: Its because you never changed the original value of template, only changed a local copy of the pointer. On line 69 you need to copy -- see strcpy() -- the value of temp_dat into template, not just assign the pointer. Line 71 is completly unnecessary and causes a memory leak. … | |
Re: [QUOTE=The Dude;821322]Ahhhhhh, I hope no one is mad about my title...[/QUOTE] I'M MAD AS HELL AND I WON'T TAKE IT ANY MORE :) | |
Re: nosibar: acceptable code tags are [noparse][code=cplusplus] ... [/code][/noparse] The way to call base class from derived [code] void DERIVED::Method() { BASE::Method(); // call Method() is base class. } [/code] Note that its not necessary to pass the this pointer because that is passed by default. | |
Re: >>Could someone tell me what I'm doing wrong? No because you need to post the class and the error message(s) | |
Re: >> if (sig[i] != text[i]) You can't use the same counter here because sig and text can be of different lengths. If sig == "screeeeewxd" and text == "scr*w?d" then I would do this: [code] int main() { char* text = "scr*w?d"; char* sig = "screeeewxd"; int i = 0; … | |
Re: >>is it bad practice to put an assignment in an if statement? IMO -- no, I have done that occasionally, especially in loops [code] int x; while( (x = getnumber() ) == 0) { // do something } [/code] | |
Re: Does anyone know what the hell NicAx is rambling about? I read the whole post and still don't know -- something about difference between married and single people. Advice: if you are jealous then get married! | |
Re: Looks like the function is prototyped incorrectly. Change the prototype in the header file to match the library. | |
Re: 1) both functions use the [b]extern[/b] keyword incorrectly. [b]extern[/b] means it is coded in some other translation unit, which the code you posted is certainly not. 2) can't tell just what the difference is because I don't know what the macro NEXT does. My guess is that it is causing … | |
Re: [URL="http://lmgtfy.com/?q=c%2B%2B+client%2Fserver+code+for+mac"]was that hard?[/URL] | |
Re: >>for(i=0;i<=2;i++) That will print 3 structures, not 2. what you want to do is use the < operator, not the <= operator. | |
Re: This appears to be some sort of 4GL SQL code that's written in original K&R style. Other than that, I don't really know what the code is doing. | |
Re: Even so, where is she? I haven't seen her here for awhile. Sad. | |
Re: Tough luck. Obama is looking out for #1 (USA) not the world. We here in USA have long disliked outsourced call centers mainly because the person on the other end of the line can't speak English very well, or speaks with an accent that is difficult to understand. So yes, … | |
Re: make a minor change and it will be easier to use and see what is going on.(you don't have to type all those numbers every time you run the program.) [code] int main() { int a[2][3] = {0}; int *ptr = *a; int count = 1; for(int i=0;i<2;i++) { for(int … | |
Re: >>char *array; That is not a 2-dimensional array. [icode]char **array[/icode] is how to declare it, using two stars not just one. Here is one way to initialize it [code] char **array = 0; array = new char*[rows]; for(int i = 0; i < rows; i++) array[i] = new char[columns]; [/code] | |
Re: line 28: delete that if statement because if the program gets that far its 100% true that the word was not found. So all you need to do at that point is display the error message. lines 22 and 23: you have already read the line that begins "Hardtop" on … | |
| |
Re: Welcome to DaniWeb. See our [URL="http://www.daniweb.com/forums/forum133.html"]Project Partners Wanted[/URL] forum | |
Re: If you want the % sine then input the data as a string then convert to double laber so that the % symbol will be removed from the keyboard buffer. [code] std::string input; cout << "Enter a percent"; getline(input, cin); double n; stringstream str(input); str >> n; [/code] | |
Re: If you want to convert that to C language then replace cout with printf() statements, fout with FILE, seeg() with fseek(), etc. | |
Re: what is a "proc file"? If you want to find the size of a file that is stored on your hard drive then there are a cople opeions: (1) call _stat() function, or (2) open the file, seek to the end, then get the current file pointer position. | |
Re: >>if (seats[position]=0) You need to use the boolean operator == instead of the assignment operator =. | |
Re: >>A request for filename /root/Desktop/scjp.txt Received.. which machine do you expect the file to reside on? If the file is on the client machine than of course the server don't find it because server is looking on its own computer. | |
Re: I would nominate [URL="http://www.daniweb.com/forums/member.php?find=lastposter&t=172938"]ArkM[/URL] due to his excellent help in the C and C++ boards (I don't know where else he is at). | |
Re: The problem is that you are leaving the <Enter> key in the keyboard after getting the number of students. After numeric input like that you have to flush the keyboard of the '\n' character. [code] double sum=0; printf("How many students are in class %d?\n",(i+1)); int t=0; scanf("%d",&t); [color=red]getchar();[/color] [/code] | |
Re: Another reason you might get that error is [list] [*]The file is already exclusively opened by another program [*]Some anti-virus programs cause that problem [/list] Try rebooting your computer to see if that corrects the problem. | |
Re: [code] <form method='post' onsubmit='javascript: validateform(this);'> [/code] Testing ... testing Yup -- its broke all right. I deleted the <b></b> from the original post and its back again. | |
[URL="http://www.telegraph.co.uk/news/newstopics/howaboutthat/4938881/Motorist-stopped-by-police-for-laughing.html"]This guy [/URL]was arrested somewhere in UK for laughing while driving. | |
Re: That's crazy. "Four Yards Worth" shouldn't have an apostrophy. And there are other wrong answers too. | |
Re: I would depend on the programming language. Boost has a regexp library for c++. | |
Re: if you can't use standard C function strcat() then your function looks ok to me. But you could also use pointers [code] void concatString(char *szTarget, const char* szSource) { while( *szTarget ) szTarget++; while( *szSource ) szTarget++ = *szSource++; *szTarget = 0; } [/code] | |
Re: C++ doesn't support animation very well -- better off using something like DirectX or OpenGL |
The End.