15,300 Posted Topics
![]() | Re: Some compilers let you select the padding size, or no padding at all regardless of what the members of the structure consist of. If I'm writing a program to transfer structures to another system then I use no padding. The problem with that is accessing members may be a little … |
I'm running 64-bit Windows 8.1 on a PC with 16 Gig RAM and 8 cores. I've noticed a lot of lag, e.g. all action momentarily stops and when it starts back up the game character quickly speeds across the screen. At other times when I join a multi-user session where … | |
Re: new is a c++, not a C. In C call malloc() or callc() to allocate memory, and free() to release it. | |
Re: We have [Starbuks ](http://www.starbucks.com/?gclid=CKzko9LWwrwCFe1aMgodnG0A1Q)around here -- good product but much overpriced. I like Hills Bros double mocha cappuccino that I make at home. | |
Re: You need to pass Number to assign() by reference, not by value so that assign() can change the structure that is declared in main(). | |
Re: Move lines 3 and 4 down after that first if statement, between lines 10 and 11. If master is null (line 10) then line 4 will cause a seg fault. In order to delete a node you have to keep track of the most recently visited node. ALLOCPTR* current = … | |
Re: Open std::ifstream for input int item_numnber[3]; float item_prices[3]; int item_qry[3]; In a loop, use ifstream's >> operator to read each field into it's array element. | |
Re: why would you want to do that with threading?? I don't see how threading would help solve the problem, except maybe for huge values of N. In that case you could split the problem up, create threads that calculate individual chuncks of data. For example, if N is 1 Million … | |
Re: There are several old MS-DOS games I would like to see ported, regardless of price. [Eye of the Beholder](http://en.wikipedia.org/wiki/Eye_of_the_Beholder_(video_game)) is just one of them. That was a very fun game. | |
Re: Is that a laptop or PC? (I don't know the solution to your problem) | |
Re: >#include "coduri functie.c" Never, ever, for any reason include one \*.c file in another. If your program uses more than one \*.c file then compile each one separately and link them both together along with any libraries to create the final executable file. How to do that depends on the … | |
Re: ODBC -- [see this tutorial](https://www.google.com/#q=odbc+tutorial+c%2B%2B). If you use one of the Microsoft compilers when you can also use ADO.NET | |
Re: [Here](http://www.cplusplus.com/reference/ctime/) is a complete list of the available time functions. When to use what all depends on what you want to do. | |
Re: delete line 30, it's already reading the file in line 27. Post the function that writes the file. A lot easier way to do it is to read/write binary files instead of text files using fwrite() and fread(). You write the entire structure as one chunk that way. But don't … | |
Re: The program is doing integer division which means no fractions because number1 and number2 are both integers. You can correct the problem by typcasting either the numerator or demoninator to float `correctanswer = (float)number1 / number2;` | |
Re: >How can I find the executable file You could just use File Explorer, enter the program name in the search bar, and let File Explorer find it for you. | |
Re: No one here is going to write your program for you. Here are some basic steps needed to complete your assignment. Step 1: create a structure that contains all the information you need to store in the file. Step 2: populate the structure with the data Step 3: using std::ofstream … | |
Re: I worked on such a project about 10 years ago, I was one of a team of nearly 100 people and it took about 3 years. | |
Is it possible to create tables in the text editor that will retain spacing -- something like code tags but without line numbers? | |
![]() | Re: The difference between `char *str="Hello World!!";.` and `char str[]="Hello World!!";.` is that char\* str is just a pointer into read-only memory where the string "Hello World" is actually stored, it's contents can not be changed. char str[] makes a copy of the string and puts it into read/write memory where … |
Re: To determine if a<b<c why not just use the normal simple if statement if( (a < b) && (b < c) ) { // true } then to determine if they are Pythagorean Triple: if( (a*a) + (b*b) == (c*c) ) { // true } | |
Re: I think you can remove the warning by initializing those two pointers to NULL when they are declared on lines 18 and 19. | |
Re: Sounds like the console window is closing and killing the mp3. Add a PAUSE in the batch file after the line that plays the mp3 to keep the console window open while the mp3 plays. | |
Re: The mode is the number that appears the most often in the array. If the array contains {1,2,1,3,4,5,8} the mode is 1 because it appears twice and all others appear only once. One way to calculate the mode is to use another 2d array, the first dimention contains a value … | |
Re: I assume you are using one of the Microsoft c++ compilers. If you want precompiled headers then every \*.cpp file in the project must include stdafx.h as the first header file. You can include any others you want after that. #include "stdafx.h" // precompiled header file goes first #include "myclass.h" … | |
Re: ODBC is probably the oldest and most widely used database api in use. [Here ](https://www.google.com/#q=odbc+tutorial+c%2B%2B)is a google list of tutorials. Then there is the Microsoft ADO DLL, I think it's the same as you use in VB. [Here](https://www.google.com/#q=adodb+tutorial+c%2B%2B) are some links for it. Some database makers also have c and … | |
Re: Your program looks correct -- what are you confused about? | |
Re: In the loop on lines 4-8, where is buffer incremented? line 4 always looks at the same character, which is why it's an infinite loop, unless buffer[0] == '\0' Try this loop while(buffer[a] != '\0') { cout << buffer[a]; a++ ; } | |
Re: pritaeas just deleted a duplicate post of mine and now the post reply count is 0 even though there is still 1 reply. I recall someone else reported the same issue a few days ago. | |
Re: please explain why you think something is wrong? ![]() | |
Re: Please post the steps you took to produce the error. Which menu items did you select, and what did you enter. Better yet, get a screenshop of the console window that contains all the information and post it here. I compiled your program with VC++ 2014 and it compiled without … | |
Re: Just call getline() which will do all that for you. ifstream in("filename.txt"); char buf[80]; while( in.getline(buf,sizeof(buf)) ) { // do something cout << buf << '\n'; } | |
Re: > line 50: this->i=2; since i is private derived classes cannot change it's value. You need to change base::set() (line 9) to accept an integer, then derived classes can call public set() to change the value of i. | |
Re: Not that I know of, but you can get the text itself. The size of the rectangle would depend on the font being used. | |
Re: That was the year Dani copyright the web site, not the current year. All coptright notices are like that. | |
![]() | Re: you can easily find out the size of an int by printing sizeof(int) -- but to answer your question, on most 32-bit compilers sizeof(int) == 4. If you are accustomed to using Turbo C, that is a 16-bit compiler and sizeof(int) == sizeof(short) == 2. But on most modern compilers … |
Re: what you want is something like this: `char i2DArray[5][20]` That will hold 5 names, and each name can be up to 20 characters long. Then on lines 13-17: Note that you only need one loop, not two loops. for ( y = 0; y < 5; y++){ printf("Enter the name … | |
Re: Delete both lines 10 and 11. Line 11 will never be executed because of the `k < k` condition in likne 10. [Here ](http://en.wikipedia.org/wiki/Loop_unwinding)is a good article about loop unrolling. One of the optomizations you would make is to calculate `i*j*ida `only once within a loop, save the result in … | |
I have another birthday anniversary today, I'm now only 39, with 32 years of experience. | |
Re: maybe something like this: void mystrcat(char* dest, const char* source) { while(*dest) dest++; while(*source) *dest++ = source++; *dest = 0; } | |
Re: line 16: I'd use int instead of double because there is no need for decimal places. lines 17-31: remove the commas, numeric literals must not contain commans. Also, add a comma after each of those lines, then add a semicolon after the last one. const int Mustang = 55000, Harley … | |
Re: The file is open for writing only. fscanf() is a read function. Solve the problem like this: line 9: open the file with "rw" flag line 15: uncomment that line. add a new line just before line 15: `fflush(fp);` which will force everything to be physically written to disk. Until … | |
Re: your program is not reading anything so fin.eof() never happens. | |
Re: Header files only contain function prototypes, not the functions themselves. You need to put the functions in a library. To use them just link the program with the library (\*.a, \*.so or \*.lib) just as you would with all other standard compiler libraries. how to create a library depends on … | |
Re: why are you passing fractional values instead of whole numbers. When you pass 0.02 does that mean to get the line that contains 2 zeros, e.g. 100? Then why not just pass 2 instead of 0.02? | |
| |
Re: You have break statements in the wrong place. Move the break statement on line 42 down to line 71. Move the break statement on line 78 down to just below line 98. | |
Re: What verson of Borland compiler are you using? Many of the old 16-bit Borland compilers were created before the c++ standards and require \*.h file extension // cin with strings #include <iostream.h> #include <string.h> #include <conio.h> //using namespace std; int main () { string mystr; cout << "What's your name? … |
The End.