- Strength to Increase Rep
- +8
- Strength to Decrease Rep
- -2
- Upvotes Received
- 8
- Posts with Upvotes
- 8
- Upvoting Members
- 7
- Downvotes Received
- 10
- Posts with Downvotes
- 7
- Downvoting Members
- 5
I'm no nerd. I'm a hunk :)
- Interests
- Lifestyle & Sports... and of course everything techie
Re: No one would ever want to implement a database using text file. The work involve are just very tedious. First of all, what are the 'data' that will be stored in your database? If it is all of a user defined structure, you can consider storing them as a binary … | |
Re: It seems that I can run the .js file from Windows. Just double click it. | |
Re: Here are some codes which you may use to record the time. [CODE] #include <time.h> time_t start, end; double duration = 0; time(&start); // your codes here time(&end); duration = difftime(end, start); // time in milliseconds [/CODE] | |
Re: If you wanna stick to your code, its fine. Just make some modification for an elegant solution. Here's my advice. I prefer to seed the random number generator first, then use the modulus (%) function to limit the generated number. [CODE] #include<iostream.h> #include<stdlib.h> #include<time.h> int main() { int i; cout<<"ten … | |
Re: Is that all the codes that you have? Did you ever set any value to your variable 'commonVar1' before calling GetcommonVar1() method? If not, I suppose the result would be unexpected and the -1 is only a coincidence. If I'm not wrong, the child's property 'commonVar1' takes precedence over the … | |
Re: I don't see anything wrong with the OOP concept being used. And in fact, it is recommended practice so that they can be reused in future. Also, I do not see any error with the code. What's the number that caused the problem? | |
Re: Your function to delete the last element from the linked list is good enough. However, do take note of the issue raised by arkoenig regarding the code [CODE] delete last; [/CODE] which apparently doesn't appear to be meaningful in the codes given. Do take note about the existence of other … | |
Re: You are getting the codes wrong. Particularly at line 14 [CODE] int fgetc(FILE *stream); [/CODE] This line is not needed. Line 18 until line 34 (while loop) can be rewritten like below [CODE] c = fgetc(stream); while(c != EOF) { // logic goes here c = fgetc(stream); } [/CODE] | |
Re: [QUOTE=chikkupa;1431171]Edit your code as: [CODE]case 2: cout<<"Enter the Customers National Number ID"<<endl; cin>>ni; for (int i=0; i<150;i++) { if (ni==CustArray[i].customer_id) { CustArray[i].showCustomers(ni); } } break;[/CODE] [CODE]// Here loop is removed void Customers::showCustomers(int ni) { if (ni==customer_id) { cout <<"Customer Information"<<endl; cout <<"*********************"<<endl; cout<<"Customer ID:"<< customer_id <<endl; cout<<"ID:"<< id <<endl; cout<<"Name:"<< … | |
Re: I don't think you can read int from the file using ifstream. The problem with your code is that they are displaying the memory location of your array. Is there any reason to use an int array? You can use the read or readline function of the ifstream to capture … | |
Re: [QUOTE=jeffpro;1431218]no those are the hex values that should be placed in the byte accordingly. char Hi[4] = "3E2C"; needs to be converted into: Bye[0] = 0x3E; Bye[1] = 0x2C;[/QUOTE] Firstly, you got to read the Hi array 2 characters at a time. For the first character, bit shift it to … | |
Re: You can include an object of class Date into Flights just like any other data types. Your initialization of the Flight classes are correct. | |
Re: Your sum function is only taking the last value entered by the user as stated below: [CODE] sum=a[x]; [/CODE] The code comes after the for loop. At this point, the value of 'X' would have been 10 and its surprising that you are actually able to execute your program without … | |
Re: Debug mode lets you step in to the code and observe whats happening behind the scene as your code runs. You can put breakpoint to stop the execution of codes at the certain statement. In addition, you can also investigate the value of a variable when running in debug mode. … | |
Re: If you're interested and serous about picking the language, get a good book. [The C++ Programming Language: Special Edition] By the creator of the language | |
Re: Please describe your problem. What's the problem you're facing. Only then, people will know how to help | |
Re: It seems like your fifth line is of different format from the rest. Its really difficult to work with file of this kind as its data can take many forms. This is a general rule: For you to read data from file, you'll need to know the format beforehand. The … | |
Re: I don't see why your code doesn't run. Your GetNext() method should be called three times as stated by VernonDozier. Hence, the same piece of information is printed on screen three times. The only reason for the program no running properly (that I can think of) is the license.txt file … | |
Re: You could code it this way to request user to enter password [CODE] cout << "Enter password for user: " << username << endl; cin >> password; [/CODE] | |
Re: The .H (header) file is more of a code organisation means to make your code readable and easily maintained. Logically, declarations and definitions are placed in the header file to allow an easy glance over the codes. All implementation codes shall go to the CPP file (with same corresponding name) | |
Re: The function's name buildBackward doesn't describe what's been done in the function. Basically, the function builds a list with all the numbers entered by user. After the number -999 is encountered, it returns a pointer to the first node of the list. Having this pointer, the printList function iterates until … | |
Re: 1000 bits = 125 bytes Therefore, to read 1000 bits, all you have to do is reading 125 bytes. Using the example given by Ancient Dragon, your code should looks like: [CODE] unsigned char buffer[125]; ifstream in("filename", ios::binary); // provide extension to filename if exist in.read(buffer, sizeof(buffer)); [/CODE] Be very … | |
Re: First off, what class do you want to inherit? Since there is no mention of a third class, it's hard to guess what class you want to introduce. Inheritance is easy. Let's say I am introducing a ChildSavings class which will inherit from the Saving class, the code would just … | |
Re: The ASCII table shows that A - Z has ASCII code of 65 - 90. On the other hand a - z has ASCII code of 97 - 122 You could manipulate the text as 'char' using ASCII code. For example, in the Caesar cipher, B (66) would be E … | |
Re: Let's post some of your initial work and we shall assist you on any problem which you may have. Or at least, post some of your thought on how you're gonna solve the problem. | |
Re: You may use if..else statement inside a case of a switch. For example, [CODE] int i = 2; bool a = true; switch(i) { case 1: cout << "Case is 1"; break; case 2: if(a) cout << "Case 2 and boolean a is true"; else cout << "Case 2 and … | |
Re: Lanor, NULL is a non-display value meaning that it cannot be seen even when it's be written to the file. In the case where you want to display the word 'NULL', you should check for null value in the grade array and explicitly display 'NULL'. Here's an example [CODE] infle … | |
Re: This is C++ and it is different from C#. You use the symbol '<<' to redirect your stream to the intended output. For example, to output the regular hours is simply: [CODE]cout << "Regular Hours Worked: " << regularHours << endl; // you would want an end of line here … | |
Re: Error LNK2019 relates to the failure of the compiler to locate an external symbol referenced in a function (linker error). Is your rstream header file in the same folder as your CPP file? Whats the full error message? Mind to post it here? | |
Re: For me, inline function is used in the situation where it will only be called from one place. The main purpose for me to implement it as an inline function is solely readability and design. That's when my function is getting too long and there are too many nested conditional … |