15,300 Posted Topics
Re: >>void main(void) [URL="http://www.gidnetwork.com/b-66.html"]Read This[/URL] lines 11 and 12: where did you defind MaxNumber and MaxCharLength? | |
Re: >>CWinsockInterface::~CWinsockInterface Sounds like something that you wrote. To my knowledge there is no such Microsoft class. | |
Re: 1) yes -- see [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/atexit.html"]ateixt()[/URL] 2) probably not. 3) No. MS-DOS had terminate-and-stay-resident programs that did something like that. | |
Re: [URL="http://www.google.com/search?hl=en&q=pictures+of+nuclear+tests&btnG=Google+Search"]nuclear tests[/URL] Nice movie and music but the tanks appear to be very very ancient. | |
Re: [code] int foo( PetInfo* pInfo) { pInfo->petType = cat; // etc. etc return 0; } int main() { PetInfo MyCat; foo( &MyCat ); } [/code] | |
Re: [QUOTE=jephthah;572887]okay, experts, i need help.[/quote] :icon_eek: I think the problem is the way you are opening the file. [quote] [b]a+[/b] Open a file for reading and appending. [color=red]All writing operations are performed at the end of the file[/color], protecting the previous content to be overwritten. You can reposition (fseek, rewind) … | |
Re: c++ has other more dependable typecasting. C-style typecasting can let you kill yourself if you don't know exactly what you are doing, such as in this example attempting to typecast to normally incompatible data types. [code] double a = 12.34; char* b = (char *)&a; int c = (int)b; [/code] … | |
Re: >>When I just run the loop two times without any statements in them, they just give any >>damn value which may have a large difference upto around 25% !!! If you have optimization enabled and have an empty do-nothing loop then the compile will probably just delete the loop altogether. … | |
Re: looks ok to me, except in the cin.getline() lines you should use sizeof instead of hardcoding the number [icode]cin.getline (text1, sizeof( text1 ) );[/icode] And you could declare a const int to define 256 instead of hardcoding it everywhere. | |
Re: Where is function [b]getline()[/b]. It isn't a standard C function so you must have written it yourself. I thought you are supposed to write the new text entered from the keyboard into the file? Your program isn't doing that. And you need to rewind the file pointer back to the … | |
Re: 1) why use double in the struct since the values in the file are only integers. 2) A linked list would be a better choice because it is easier to add new structs. [URL="http://richardbowles.tripod.com/cpp/linklist/linklist.htm"]Here [/URL]is one of the many tutorials you can find with googler. | |
Re: never ever for any reason use gets(). [URL="http://www.gidnetwork.com/b-56.html"]Here's why[/URL]. >>Could it have something to do with using gets()? Yes. [b]instr[/b] can only hold 9 characters plus the null terminator and you are trying to stuff more than that into it. gets() is scribbling the overflow all over your program's memory. | |
Re: >>but my inner loop for j is working again and agian instead of just working for 3 times. are you talking about function addBlackBook() ? Of course it does because you told it ro run that j loop 500 times (line 56)! | |
Re: >>string subChoice =""; It isn't necessary to provide an initializer for strings because that's the default. Just [icode]string subChoice;[/icode] is sufficient. >> do we ever need to use the "compare" function You use it when you need to know if one string is less than, equal to, or greater than … | |
Re: In ComplexNumber::ComplexNumber you are supposed to set the values of the class variables to that of the parameters. [code] ComplexNumber::ComplexNumber(double r, double i) { this->realPart = r; this->imagenaryPart = i; } [/code] in main() move the line [icode]ComplexNumber userInput(c1, c2); [/icode] down to after the user has entered the values … | |
Re: line 35: you need to pass variable grade by reference to that Get_Letter_Grade() can change its value. Then in main() you need to save all the graded in an array so that the GPA can be calculated. line 39: the value of [b]number[/b] is never set to anything so all … | |
Re: Very humerous and very very true. I saw a lot of drunks like that when I tended bar 30 years ago. | |
Re: line 4: >> class string give you class a different name because [b]string[/b] is the name of std::string that's in the <string> header file. What compiler are you using? If TurboC++ then trash it and get a new compiler if you can because some of the code you are writing … | |
Re: The loop at lines 28-32 could be better written like this: [code] int i = 0; while( i < arraysize && infile >> numbers[i] ) { i++; } [/code] line 34: do you know for a fact that the file contains exactly 8 integers? It would be better to pass … | |
Re: here is an example that uses stringstream as helper. See [URL="http://www.daniweb.com/forums/thread90228.html"]this thread [/URL]for explaination of line 27. [code=cplusplus] #include <iostream> #include <sstream> #include <fstream> #include <string> #include <limits> using namespace std; int main() { std::string one; int Number = 0; std::string line; std::string two; std::string three; ifstream File("..\\TextFile1.txt"); if(!File.is_open()) { … | |
Re: you have to put the timer code in a second thread then when someone types something in thread1 kill the timer thread. How to construct new threads depends on the operating system. | |
I have been using the Insert Link button every since I Joined DaniWeb and it always worked perfectly. Until now. [URL="http://www.daniweb.com/forums/post572769.html#post572769"]here[/URL] The above link shows the results. The way I do it is first highlight the words I want then hit the InsertLink round button, copy the URL and finally … | |
Re: If the data contains random-length records or lines then you have no other choice but to use sequential access. As always, there are a few exceptions, such as if you create an index file that contains the offsets to the beginning of each line or record, but probably goes beyond … | |
Re: line 18: >>!cin To my knowlege that can never happen so you might as well delete it. Otherwise you program seems to work ok for me. | |
Re: Depends on whether the child process is a console application or an MS-Windows program. Console: just return the int value from main(). MS-Windows: [URL="http://msdn2.microsoft.com/en-us/library/ms644945.aspx"]PostQuitMessage[/URL]() On the parent process side: After calling CreateProcess(), call WaitForSingleObject() then when that returns call [URL="http://msdn2.microsoft.com/en-us/library/ms683189(VS.85).aspx"]GetExitCodeProcess[/URL]() to get the exit status of the spawned program. Note: … | |
Re: 1) Stop spamming this board with all those new threads about the same program. Just continue adding to the thread you already have. 2) Learn to use code tags 3) Learn to format your code better so that you and other people can read it easier. I also made a … | |
Re: use friend functions [code]#include <iostream> using namespace std; class c2; class c1 { public: friend c2; c1() {} private: void SayHello() {cout << "Hello\n";} }; class c2 { public: c2() { p1 = new c1;} ~c2() {delete p1;} void Hello() {p1->SayHello();} private: c1* p1; }; class c3 { public: c3() … | |
Re: Functions writtein in C language can be called by almost every other language. For example: most, if not all, the win32 api functions for MS-Windows operating system were written in C language and some assembly. Yet all these functions can be called by every other existing language such as Visual … | |
Re: [QUOTE=coolerfantasy;571029]Hi Guys Can Pointers In C Points To The Video Memory And Write A pixels On The Screen Or Calls Bios 10H To Do That , What About That : void far *scr = (void far *) 0xA0000000L[/QUOTE] [QUOTE=coolerfantasy;571856]why allways there is a jerk persion thinks him self have big … | |
Re: First figure out how to split the string then worry about how to write the overload operator. What kind of string -- character array or std::string? How are you supposed to know where to split the string? Is there something in the string that is supposed to tell you where … | |
Re: why did you put a return in the middle of main() ? Lines 12-19 will never get executed because of that unconditional return on line 11. Just delete line 11 and the reset will be executed. | |
Re: >>(D/4) + (C/4) This is doing integer arithmetic, meaning all decimals are discarded leaving only the integer portion. try casing to double to see if it fixed your problem -- I don't know whether it will or not [icode] ( (double)D / 4.0) + ( (double)C / 4.0) [/icode] | |
Re: >>Hi I am New I want Vb.net help is anyone there In the beginning God created the heavens and the earth. Then he created Adam & Eve, who started having babies, granchildren, great grandchildren, etc. etc. Eventually Bill Gates was born and he became the savior of the computer geeks. … | |
Re: >> strncpy_s(thevalue,sizeof(thevalue)-1,temp,templength); theValue is a pointer, so sizeof(theValue) is the size of a pointer which is 4 on all 32-bit compilers. | |
Re: He's probably shaking his head because that racket hurts his poor ears. I do that too when I hear that awful racket :) | |
Re: Army sucks. Go Air Force :) (I'm retired US Air Force if you hadn't already guessed) Manditory military service is good for the soul and for what ails you. Joining a military will make a man out of you. Every young man ages 18-25 should experience at least two years … | |
Re: From the error number I'd say you are using one of the Microsoft compilers. If that is true you can easily and quickly find out the missing { or } by putting the cursor on one of the brackets and hitting Ctrl+{ or Ctrl+}. This doesn't work so well if … | |
Re: Or you could use std::string's at() method, but I don't see that very often.[URL="Error: c-project_.c(7,2):Unable to open include file 'stdbool.h"] Read this about it[/URL]. | |
Re: use a while loop [code] bool done = false; while( !done ) { //show menu and execute switch statements or other stuff } [/code] You can use other kinds of loops too, depending on what you want it to do. | |
Re: line 32 sets status to something other than 10. That means its value is not 10 when line 40 is executed, so the loop continues. I would use a different variable, such as [icode]bool found = false[/icode] then set it to true when line 30 is executed. [code] bool found … | |
Re: [URL="http://www.cplusplus.com/reference/iostream/istream/tellg.html"]tellg()[/URL] [URL="http://www.cplusplus.com/reference/iostream/istream/seekg.html"]seekp()[/URL] You can read all about the other fstream methods [URL="http://www.cplusplus.com/reference/iostream/fstream/"]here[/URL] If you are still confused after reading the above links please explain what you are confused about. | |
Re: I think I know what you want to do -- create a 2d linked list [code] typedef list<TREE> LTREE; list<LTREE> L; [/code] | |
Re: [QUOTE=iamthwee;272901]Me too, but I was cutting chili peppers before and forgot to wash my fingers...[/QUOTE] :mrgreen: :mrgreen: :mrgreen: | |
Re: line 7 vijay's function declaration is wrong or just plain convoluted [icode]void copy_string_to_array( char array[N][N], const char* cstr )[/icode] >>I am having a problem for coping the string into a 2d array.. [code] // the following array will hold up to 4 strings, and each string can be no more … | |
Re: >>print(grid, rows, columns) Well, where did you declare the variable [b]columns[/b] ? You have to declare variables before they can be used or passed as parameters. | |
Re: Look at the file in Notepad or some other text editor to see if the contents are what you expect. | |
Re: I think enough of the squabbling from everybody. Thread closed. | |
Re: Good god what is crappy code you posted with has no line breaks ???? I was going to add code tags for you but they would be useless the way that code is formatted. |
The End.