15,300 Posted Topics

Member Avatar for Vipervneom9

Is there something wrong with the code? You don't need to call endl but rather do like this: [icode]cout << a << "\n\n";[/icode]

Member Avatar for Ancient Dragon
-2
118
Member Avatar for johndoe444

There is no one place. For *nix its normally the man pages. You can access them by googling "man function_name". For MS-Windows it would be MSDN. You can also just google for the c++ container class, e.g. fstream. If you want the absolute authority then you will have to BUY …

Member Avatar for Ancient Dragon
0
173
Member Avatar for tom384

Try a little redesign of the program by removing all those static objects and pass them by reference into the functions, such as [icode]void load_character(Character& ret)[/icode] Your program will use less memory that way too.

Member Avatar for tom384
0
293
Member Avatar for heynow12

lines 8 and 9 [code] int i, max_val; double x[max_val]; [/code] What is the value of max_val? What is the size of array x?

Member Avatar for josolanes
0
1K
Member Avatar for SIFA

character arrays that are created on the stack like iReturn[] can not be returned because they are destroyed as soon as the function returns. You have two options 1) Have the calling function create the array and pass it to GetBase2() as a parameter, such as [icode]char* GetBase2(int iBase, int …

Member Avatar for Ancient Dragon
0
134
Member Avatar for johndoe444

1. exec gives you a lot more control, look in the man pages or use google and you will find all the different ways exec can be used. 2. Either redirect the output such as [icode]system("data >filename.txt")[/icode] to a file or use pipes. 3. Why not? For each fork() you …

Member Avatar for aspire1
0
83
Member Avatar for vbx_wx

Look at the function kbhit() in conio.h, which is non-standard and not supported by all compilers.

Member Avatar for Nick Evan
0
109
Member Avatar for girishn
Member Avatar for avsatheesh

Number of iterations? Infinite. Why? because 1/2 = 0 (integer division) so the value of x will never change.

Member Avatar for Ancient Dragon
-3
187
Member Avatar for mathpro

You have made that problem a lot more difficult than it needed to be. [code] int compare(const void *x,const void *y) { return(* ((int*)x)-*((int *)y)); } int qsortselect(int keys[], int n, int size) { qsort(keys,n,sizeof(int),compare); int x = keys[size]; return x; } int main() { int A[5]={3,5,67, 7, 2}; for(int …

Member Avatar for some
0
199
Member Avatar for max.v8

[QUOTE=Adak;1178002] [CODE] int count[101] = { 0 }; //assign all elements to zero value if (your char is a number from 1 to 100) count[char + '0']++; //remember count[0] will not be used here. [/CODE][/quote] Your example is just a little bit wrong. The file contains integers, so if they …

Member Avatar for max.v8
0
181
Member Avatar for HeavySoul

strcmp() is case sensitive, meaning that the word "Hello" is not the same as the word "hello". Maybe that is what is going on with that program. Try using a case in-sensitive comparison, such as stricmp(). The same function might be called something else on g++ compiler, such as comparenocase(), …

Member Avatar for girishn
1
134
Member Avatar for wesselnaude

>>void print_hello(int n, int *) What is that second parameter for? All that is doing is printing one line of * below the text. What about above the text and on each side? [quote] **************** ** Hello World *** **************** [/quote] This is how to do it [list=1] [*]Print the …

Member Avatar for Ancient Dragon
0
101
Member Avatar for bhanukarumudi

What the hell makes you think I'm going to do your work for you? I have my own to do.

Member Avatar for Ancient Dragon
-1
105
Member Avatar for infrapt

>>/N=7 2^N=128 That is bytes, not bits (see [URL="http://groups.csail.mit.edu/cag/ps3/cell_pointers.shtml"]this link[/URL]). 128 bits is 16 bytes on computers where 1 byte is 8 bits.

Member Avatar for Ancient Dragon
0
105
Member Avatar for macobex

I never create a pointer to a vector -- pointer here is just not necessary. Your third example is the most common way to do it.

Member Avatar for n.utiu
0
138
Member Avatar for karolik

>>static long count; >>count++; Your program is incrementing an uninitialized integer and then you use that integer later on in the function. initialize it to 0 [icode]static long count = 0;[/icode]

Member Avatar for karolik
0
142
Member Avatar for JohnPhilipps

You need to add a constructor to Rectangle that takes no parameters -- that's called the default constructor.

Member Avatar for JohnPhilipps
0
235
Member Avatar for karthiken07

Its not possible in any language. Files don't know a thing about fonts. As for Notepad.exe I know of no way to change it from a c program.

Member Avatar for Ancient Dragon
0
158
Member Avatar for Xufyan

>>but don't kn0w how t0 apply it for 3 c0nditions ? Is the o key broken on your keyboard? [icode]if( a > b) ? a : if( b > c) ? b : c;[/icode] You could in theory just keep going on an on like that, but it will just …

Member Avatar for jephthah
-2
166
Member Avatar for jephthah

I found setjmp and longjmp quite useful in database programs to quickly return errors between deeply nested function calls. c++ exceptions are the alternative in c++ programs. goto is only useful within the same function. setjmp and longjmp are between functions, although could be used within the same function too.

Member Avatar for nezachem
0
137
Member Avatar for gnarlyskim

If you used c++ <vector> class you would not have to worry about it because that class will do all the expanding for you. But if this is homework then you may or may not have that choice.

Member Avatar for gnarlyskim
0
149
Member Avatar for misterjay3

>>Can someone help me with this???? Help you with what? We don't do homework for you -- that's your job as a student.

Member Avatar for Sumyungi
0
116
Member Avatar for deckchairboy

[b]Error. Can Not Find Keyboard Press any key to continue[/b]

Member Avatar for bumsfeld
1
372
Member Avatar for petteyg

>>s this code portable between operating systems No. Works only on MS-Windows because it appears to be using win32 api functions. There is no portable way to do what you want using any standard C or C++ functions. There are non-standard functions, such as ncurses which I know has been …

Member Avatar for petteyg
0
255
Member Avatar for Frederick2

The four bytes before the beginning of the BSTR is the number of bytes allocated to the BSTR, which may or may not be the length of the string. In fact the BSTR need not contain a null-terminated string at all (either UNICODE or ascii). It could contain binary data …

Member Avatar for Frederick2
0
2K
Member Avatar for MyrtleTurtle

>> //NOPE! Doesn't add 1st digit... because it's stuck in 'ch' b/c of inFile.get(); call inFile.unget() to put the digit back onto the stream.

Member Avatar for MyrtleTurtle
0
125
Member Avatar for jacksparao

Start out by posting in Game Development forum. How well do you know c language? Or any other programming language ?

Member Avatar for Adak
0
93
Member Avatar for timbomo

Those are called [b]function prototypes[/b] and they don't go in main(). Put them near the top of the program unit, after all includes. Alternatively, you can create your own header file and put them there. [code] #include <iostream> #include <string> // other includes here int score_num(int& ns1,int& ns2,int& ns3, int& …

Member Avatar for mattjbond
0
414
Member Avatar for PSP1202

The square root of a negative number is an imaginary number. sqrt(-1) is not -1. To confirm this, see [URL="http://www.csgnetwork.com/squarerootsquarecalc.html"]this calculator[/URL]

Member Avatar for Banfa
0
316
Member Avatar for DSalas91

There are several ways to solve that problem. IMHO this is the simplest. sprintf() is your friend here [code] char filename[255]; // final file name char* namePt1 = "Labyrinth"; int num = 5; sprintf(filename,"%s%d.txt", namePt1,num); ofstream fileLabyrinth(filename); [/code] Alternate method is pure c++ [code] string filename; string namePt1 = "Labyrinth"; …

Member Avatar for DSalas91
0
187
Member Avatar for prade

I agree with your teacher. TurboC is very ancient. Did your teacher suggest a compiler? If not, there are several of them you can use Code::Blocks with MinGW compiler VC++ 2008 Express just google for those names and you will find their download links. But what does that have to …

Member Avatar for Ancient Dragon
0
91
Member Avatar for johndoe444

Don't do that even if you would. The macro is too large and will greatly increase the size of the final program. Just write a normal function that takes variable arguments.

Member Avatar for johndoe444
0
118
Member Avatar for PTRMAN1

The functions isalpha() and isupper() will tell you whether the character is an upper-case character or not [code] for(int i = 0; i < userInput.length(); i++) { if( isalpha(userInput[i]) && isupper(userInput[i]) ) count++; } [/code]

Member Avatar for PTRMAN1
0
127
Member Avatar for Iam3R

1. Because they said so. Why would you want to comment out the comments? If you want to comment out a large block of code that may contain comments, then there are other ways to do it. I do it like this. [code] #if 0 // code here #endif [/code] …

Member Avatar for Narue
0
287
Member Avatar for smeghead007

What problem(s) are you having? You can't take your car to a repairman and tell him "my car is broke please fix it".

Member Avatar for abhimanipal
0
116
Member Avatar for edek
Member Avatar for timbomo
Member Avatar for priyankapandey

Please stop putting your questions in quote tags -- it just makes your posts confusing to read/understand.

Member Avatar for priyankapandey
0
307
Member Avatar for priyankapandey

Why would you want to make it [b]void[/b]? [code] double** foo(int rows, int cols) { double ** ptr = malloc(rows * sizeof(double *)); <snip> return ptr; } [/code]

Member Avatar for Narue
0
1K
Member Avatar for MyrtleTurtle

I've seen "report bad posts" forums that on other web sites too, but the way DaniWeb does it is a lot easier. We don't have to copy/paste a link into another forum to report it. Hitting the Flag Bad Post link does it all :)

Member Avatar for jbennet
0
233
Member Avatar for johndoe444

[URL="http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/index.jsp?topic=/com.ibm.vacpp6m.doc/language/ref/clrc09lc.htm"]Read this link[/URL]. [quote]In order for the compiler to produce meaningful references to line numbers in preprocessed source, the preprocessor inserts #line directives where necessary (for example, at the beginning and after the end of included text). [/quote] When the preprocessor parses your *.c program it will create a *.i …

Member Avatar for Ancient Dragon
0
109
Member Avatar for Xlphos

If you have time (within 30 minutes of the original post) just remove all the text and write "<deleted>" or something like that, then PM one of the mods who MIGHT delete it.

Member Avatar for Nick Evan
0
213
Member Avatar for PinoyDev

Depends on the file's contents. As a general rule of thumb, just open the file as a normal text file and read its contents one line at a time. Beyond that, you will have to tell us what's in the file.

Member Avatar for PinoyDev
0
133
Member Avatar for blackrobe

>>How can I terminate a server after some number of connections Put [icode]exit(0);[/icode] after the loop ends on line 21.

Member Avatar for nezachem
0
169
Member Avatar for junezy4

One way to do that is to create a structure that contains the strings and an integer [code] struct words { char* word; int count; }; [/code] Now make a simple array of these structures and initialize all counts to 0 and character arrays to the words in the list …

Member Avatar for targ2002
-3
145
Member Avatar for COKEDUDE

[QUOTE=COKEDUDE;1173363]I thought since you need [ICODE]#include <ctype.h>[/ICODE] for [ICODE]tolower()[/ICODE] it is not standard. Why would you have to include [ICODE]#include <ctype.h>[/ICODE] if it is a standard function?[/QUOTE] All functions have to be declared before they can be used, whether they are standard C functions or not. Standard functions are not …

Member Avatar for WaltP
0
908
Member Avatar for LevyDee

Read [URL="http://winprog.org/tutorial/"]this tutorial[/URL]. It has a section about menus and other resources.

Member Avatar for Ancient Dragon
0
85
Member Avatar for rizzi143

change the structure to use std::string instead of the char data. Then change the insert function to get a string from the keyboard instead of a single character. You will probably need to make other appropriate changes to your program as well.

Member Avatar for Ancient Dragon
0
130
Member Avatar for junezy4

The solution is pretty easy if you think about it. Every character in the English alphabet, and other characters too, have a numeric value between 0 and 255. To see what they are just google for "ascii chart". Given that, create an int array of 255 elements and initialize all …

Member Avatar for Ancient Dragon
-6
170

The End.