15,300 Posted Topics
Re: probably want something like this. The function should return a const char* [code] const char* Stack:peek(void) const { return topPtr->item; } // example calling Stack stack; const char* item = stack.peek(); [/code] | |
Re: [QUOTE=nanodano;272209]Have any of you competed in the topcoder matches?[/quote] Nope. [QUOTE=nanodano;272209] Have you found them helpful?[/QUOTE] Don't know, but I suspose they probably are. | |
Re: Microsoft VC compilers are really intended for mediam to large projects. Yes it is pretty complicated to learn, but you can't beat its debugger, object browser, intellsense, and several other features. With single-file programs you will be better off using a simpler IDE like Dev-C++, or a command-line compiler and … | |
Re: Hummmm -- why don't you just use CString's assignment operator? strcpy() is for C-style character arrays, not c++ classes. The code in that link is incorrect -- you can not pass CString to strcpy() like that. You will stumble across quite a few printing errors like that in books because … | |
Re: [QUOTE=Bench;271977]Reading from a file works the same way as reading from any other istream, such as cin: [CODE]//read up to newline std::string str; std::getline(cin, str);[/CODE] [CODE]//read up to whitespace (after a word or character) std::string str; cin >> str;[/CODE]With files, replace [I]cin[/I] with the name of your ifstream[/QUOTE] and just … | |
Re: The keyboard and screen are treated just like files. There are three files that are always open when your program: stdin, stdout, and stderr are 0, 1, and 2, respectively. stdin is the keyboard, while stdout and stderr are the monitor. [URL="http://www.wlug.org.nz/stdout(3)"]Here[/URL] is more information about them. int 21, 40h … | |
Re: [quote] had a influencial programming professor (Dept. Chair, actually) who would say:"Indenting? Nah, that's a waste of time-- I don't care if its all pretty. It just matters that it runs." [/quote] Tell him he is an idot and has no business trying to teach anything but maybe a basket … | |
Re: >>Could u pls write a c progra for this Ok, wrote it in about 30 minutes, but I'm not going to post my solution until you post yours (that works) | |
Re: >>You attacked VB programmers in general, implying that their art is "child's play" Isn't it? Any 10 year old child can program in that language. Most [b]real[/b] professional programmer would not be caught dead using VB. But that attitude may change in the future with VB .NET because it can … | |
Re: I hate boxed instant mashed potatoes -- I refuse to eat them and will not eat in any resturant that serves them. We always have the traditional Thanksgiving day dinner (turkey, mashed potatoes, sweet potatoes, green-bean casserole, cranberries, turkey pie) and I always gain about a ton during that week. … | |
Re: what is the purpose of that do loop? Why not just remove it ? And you don't need that switch statement if you put the month names in an array of strings. [code] char *months[] = { "", "January","February", ... "December"} cout<< months[monthnum] <<setw(20)<<year<<endl; [/code] | |
Re: This is a c++ program, why are you using c-style char arrays. Unless your instructore requires it you should probably be using std::string as input buffer. You do loop is all wrong. Use a while loop instead for better control. [code] std::string inbuf; while( getline(infile,inbuf) ) { // blabla } … | |
Re: you have to give the arran a name [code] player = numPlayers(int [color=red]MyArray[/color][NUMPLAYERS]); [/code] | |
Re: You need to download the [URL="http://www.microsoft.com/whdc/devtools/ddk/default.mspx"]Windows Device Driver Kit[/URL] Can't help with your driver because I have never written on either. [edit]I see from reading that page you might be too late -- the DDK for Win98 is no longer supported or available from Microsoft. Unless I misread it, that … | |
Re: The number of braces in printShipPos() looks ok to me. [code] srand((unsigned)time(0)); //RNG float shipPos; for(int index=0; index<1; index++){ [/code] two comments: (1) srand() should only be called once throught the lifetime of the program. Best place to put it is near the beginning of main() function. (2) I hope … | |
Re: first you need to know what programming language was it written in and for what operating system -- assembly, C, C++, BASIC, VB, pearl, pascal, or any one of hundreds of others. If you don't know, then please post some of the code and someone may recognize the language. | |
Re: depends on the operating system. MS-Windows and *nix: you can not do that because the os will not permit it unless the address is one which you got from allocating memory using malloc(). in assembly just store the destination address in edi register, source address in esi register, number of … | |
Re: Please read my signature and follow the link | |
Re: you posted the requirements, you posted the code. Now, please edit your post to use [URL="http://web.daniweb.com/techtalkforums/announcement8-3.html"]code tags[/URL] so that we do not go blind trying to read all that unformatted code. >>I dont really understand what to do next... to match the sample output of this; I think you were … | |
Re: in the OnButtonAdd() event handler for the button 1. assume m_sum, m_add1 and m_add2 are integer class member variables which were defined using ClassWizard (VC++ 6.0 compiler), just call UpdateData() after setting m_sum = m_add1 + m_add2. [code] void OnButtonAdd() { // move window text into member variables UpdateData(TRUE); m_sum … | |
Re: >>char ArraySize =[11][25]; This is incorrect syntax. >>strcpy(hold, arrNames[j]); variable [b]hold[/b] is defined to be a single char. You can not copy a string to a char variable. >>void Quit(char [11][25]); Function prototype and actual function are different. your compiler will produce [b]unresolved externals[/b] error. | |
Re: The only online game I have ever played it Blizzard's Diablo II Lord of Destruction. I've been playing for 10 years or so and have beaten the bad guy I don't know how many times. I now have a cheat program that gives my character godly powers so that I … | |
Re: [QUOTE=sharky_machine;270917] save the paper for NEXT year [/QUOTE] I have never seen anyone actually do that in my lifetime. Remove the paper neatly from the box, fold it up nice, then toss it into the trash can.:mrgreen: | |
Re: you will have to add a little code to getOvertimePay() to make that check. First, check for over 60 hours. If its over 60 then calculate 2.0 rate. If not over 60 then do what the function does now -- you don't need to change that part. Something like this: … | |
Re: I think you should be using a map, not a multimap. ![]() | |
Re: [QUOTE=Anonymusius;266202]indeed, I have an AK security off fully loaded in my glove department. When I ride an speedbump you better duck. I mean come on, who has an [b]loaded[/b] gun in his glove departement? What happened with to the believe in society?[/QUOTE] Depends on where you live. What good is … | |
Re: >>if (check = true) you should use == boolean operator here, not the assignment operator. | |
Re: you have already coded all the required overload operators. In main() just use them like this [code] int main() { Complex x; Complex y( 4.3, 8.2 ); Complex z( 3.3, 1.1 ); cout << "x: "[color=red] << x;[/color] [/code] | |
Re: use unsigned long intead of int. But first check for the maximum value for your compiler in the file limits.h. The maximum value for an unsigned long on my compiler is 4,294,967,295 -- slightly smaller than the value you want. You may have to go with a 64-bit integer, longlong … | |
Re: you are probably using controls and dialogs that are not supported in Win98. Read the system requirements in MSDN for the dialogs/functions you are using. For example, is your dialog using UNICODE strings? If it is, then it won't work in Win98 because that os does not support UNICODE. | |
Re: [QUOTE=may4life;270687]Here's a working example of how to reverse a string using a function. Hope this helps, good luck! [code] #include <iostream> using namespace std; void ReverseString(char string1[], char reversed[]); int main() { const int MAX = 80; char string1[MAX]; char reversed[MAX]; cout << "Enter your string: "; cin.get(string1,MAX); ReverseString(string1, reversed); … | |
Re: there are only 255 possibilities, so just make an int array 255 and use the character as the index [code] int count[255] = {0} char c = 'A'; ++count[c]; [/code] when done the elemenets of count > 0 is the frequency you want. | |
Re: First, you don't need to load the dlls. just include windows.h and you will have access to most of the functions you need [code] #include <windows.h> // your code here [/code] Which functions do you need? I don't know, sorry. | |
Re: [QUOTE=JS1988;270472]Does anyone know how to writea program to print [/QUOTE] Yup. Next question :) create two loops -- outer loops counts backwards from 10 to 1, the inner loop counts forwards from 1 to the value of the outer loop counter. Then print the value of the inner loop counter. | |
Re: >>But if I run the program it still works. You are not running the program that you think you are unless you are using a really really old and ancient compiler. None of the compilers I have seen in recent years will produce an executable program when there are compiler … | |
Re: [QUOTE=Morutea;265863]Hello all, It is my first post :) I want your thoughts on this: Do you feel that because your parents may have supported you when you were younger, that you "owe" it to them to support them now? (Pay the bills they run up etc, just because they did … | |
Re: >>Do the variable names survive the compilation process? If someone was to read compiled code in raw memory, would they see the variable names? No. Compiled porgrams know nothing about variable names -- they are all nothing more than addresses. Variable names are only for you, the human programmer. >>Also, … | |
Re: if you posted the wrong code then you need to post the correct code. We don't care if the code you posted doesn't work. Post the code you know how to do then we can talk about how to complete the assignment. by "mark" do you mean "grade" ? >>the … | |
Re: I don't like the American version of football -- too dull, uninteresting and brutal. European football (what we call socker) is a lot more exciting. | |
Re: use Explorer to delete the project directories, then in VC++ 2005 IDE Start page click on the project name. You will get an option to remove the project. If there's a quicker method I sure would like to know too. | |
| |
Re: variable [b]charge[/b] is declared both as a global and as a local variable inside main(). Delete the variable in main() because it hides the global. | |
Re: all I see from the original post is a picture that has a stack of CDs next to a few books. Pretty picture, but I don't think it contains anything illegal. maybe the immage was changed since the original post??? | |
Re: [QUOTE=Tauren;270024]Umm *Looks to the left*.... *Nods head shakes head questions...?* If you didt get that message then that means Confused[/QUOTE] why answer this year-old thread? I doubt anyone really cares any more. I'm going to close it | |
Re: [quote]There are 299,968,595 people in the United States of America. If everyone in the U.S. lined up single file, the line would stretch around the Earth almost 7 times. That's a lot of people.[/quote] Now compare that with the population of China (1,284,303,702 -- 2002 est). Yet the area of … | |
Re: What operating system are you using? That is a [URL="http://unixhelp.ed.ac.uk/CGI/man-cgi?ioperm+2"]linux function [/URL]and not supported in MS-Windows. But if you are using linux then I don't know the answer because I don't have a linux computer available to me where I am at. | |
Re: packets of what? If your program is doing the sending, then yes | |
Re: you need to post your code that does not work. One way to do it is use strpbrk() function [code] char text[] = "Hello World"; // filter out 'H' and 'W' letters char filter[] = "HW"; char *p = strpbrk(text,filter); // if p == NULL then text[] does not contain … | |
Re: depends on the operating system -- *nix or MS-Windows? (MAC I don't know about). I believe there are some boost c++ classes that will make your code portable between operating systems. MS-Windows: FindFirstFile() and FindNextFile() [URL="http://www.daniweb.com/code/snippet370.html"]Here[/URL] is a code snippet that illustrates how to use these functions. *nix: opendir() and … |
The End.