345 Posted Topics
I've been debating where to put this. Maybe the Community Center. Feel free to move if necessary. I'm sticking it in Software Development because it has to deal with Software Development, but it's more of a general topic involving different levels of expertise and familiarity, what one's "lane" is, and … | |
Re: http://www.cplusplus.com/reference/ctime/localtime/ The example above gives TODAY's date/time. To get yesterday's data, subtract the number of seconds in a day, as below. In addition, using the strftime function, you can isolate just the date. http://www.cplusplus.com/reference/ctime/strftime/ /* localtime example */ #include <stdio.h> /* puts, printf */ #include <time.h> /* time_t, struct tm, … | |
Re: > The Idea is that the file can be distributed with special CD/DVDs which we will recommend to our customers, and they can insert the removable media that contains the files to the media player, if the file is MP3 then they will just play it, but I don't want … | |
Re: I have no C# or Visual Studio advice to offer. I'm a Code-Blocks C/C++ guy, so if you need something specific to C# or Visual Studio, stop reading here... ;) Disqualifiers aside, is this a continuation of your earlier threads sending class objects down a TCP stream socket? I'm unfamiliar … | |
I am a member of another forum and forgot my password, so I clicked the "Forgot password" link and was told "fill this form out and we'll send you your lost password" or words to that effect. It occurred to me that I had never seen language like this and … | |
Re: > I love this topic. I love this topic too. What I DON'T understand is why `srand(time(NULL))` and `rand`, which is what we're all taught to use, are such lousy random number generators and you have to look elsewhere if you want decent random numbers. It's an interesting topic, but … | |
Re: Regarding conio.h, getch, clrscr, not everyone has conio.h. You might try changing iostream.h to iostream. "void main" should probably be "int main" and your main function should return 0. Those "problems" might allow it to compile on your machine and not on others, but the actual errors are below. 1. … | |
Re: Your method is inefficient. Suppose len1 equals 5 and len2 equals 15. I have an input file containing a million words and my goal is to create 10 files ("5-length-pass.txt", "6-length-pass.txt", ..., "14-length-pass.txt"). You are trying to read the in the entire input file 10 times. That's inefficient. How about, … | |
Re: This is a variable scope error. You declared the variables salesman_ind, prod_ind, salesman_hs, max_prod in the code bracketed by the brackets starting on lines 10 and ending on line 40. That means you cannot use those variables outside lines 10 to 40. They go "out of scope" after line 40 … | |
Re: You still have a bit of the same problems as your last thread. I switched the input around so you call a function to get a letter and a function to get a float. Error checking and gobbling up white space is done in those functions. You have some obsolete … | |
Re: EDIT: Below was my original post, before how little memory Transaction requires sunk in. I'm thinking now that the real issue might be Little Endian versus Big Endian and the internal storage of the data on each machine versus the very small amount of data to be transferred (32 bytes?). … | |
Re: Here's roughly how the compiler processes this code if (Name == "Peter"|| "John") { cout << "Hello, master! How are we feeling to day?" << endl; cin >> Mood; } else { cout << "Hello, " << Name << "!!!"; } This if (Name == "Peter" || "John") is not … | |
Re: > Note what item they listed first. And note what item they listed last. Surprised at that one. Seems like "communicate clearly" and "get along with co-workers" should be grouped together at the top of the list. What good are good communication skills if you can't get along with anyone? … | |
Re: > Please elaborate. Yes. More info is needed. I was thinking about this one and it's clear that Stagnant and I already interpreted this problem differently as far as how the "thick line" would be drawn. Regardless, I concur that this is a Geometry problem, not a problem of Windows … | |
1. Log In 2. Click Inbox 3. I see the PM page 4. Click "Log Out" from "AssertNull" dropdown menu to the left of "Finder" dropdown menu. 5. Directed to Dazah permissions page: "DaniWeb uses Dazah to power its social features and requests the ability to: Manage your Dazah user … | |
Re: Not sure why you'd be getting that behavior. What is the exact input you are using? What is the corresponding output? Your code runs fine for me. The only thing I can think of that might be happening is that between getchar and scanf and whatever you are typing in, … | |
Re: >That's all well and good but how about making it modern? That is, why must it have a convert button at all? If one were to respond to >changes in the entry boxes then it would be instant conversion from F to C and so on. >Think mobile, phone users. … | |
Re: I note that you have both C and C++ tags on this. I assume you are using a C compiler. If C++, then consider using a vector of C++-style strings. vector and C++-style strings are both dynamic, but you are not responsible for keeping track of the memory. Assuming this … | |
Re: > I'm assuming that the entered trans_code is to be either 'a' or 'b'. I agree with hericles in his input assumptions and his solution. I will add that it is a good idea to display to the screen what the legal options are, like so: System.out.println("Please enter a single … | |
Re: You could keep track of the LAST character type you extractedand compare it to the current type (i.e. digit). So when you grab a '1', you don't immediately assume you are done extracting the number. You grab the next digit '2' and notice that it's a digit, so you keep … | |
Re: The coding is secondary to the algorithm in projects like these. This is a pencil and paper exercise till you figure out what process you want/need to use. A few things to consider... 1. You need to determine exactly what you have to be able to handle in this program. … | |
Re: Bounce rate might not be a terrible thing, depending on the site. I would guess that my and most people's Stack Overflow bounce rate is fairly high, but that's from a search engine, not social media. Google "makefile no rule to make gcc" or something similar and the first half … | |
Re: > I need to make sure my integer variable doesn't store more than 2 bytes. The integer will "store" however many bytes it is defined as having. See sizeof() as rproffitt says. No test is required to make sure that a 2-byte integer will store only two bytes, so the … | |
Re: Are you using C++98 or C++11? The function definition for "new" is slightly different between the two. http://www.cplusplus.com/reference/new/operator%20new/ http://www.cplusplus.com/reference/new/operator%20new[]/ If you are making a custom "new" operator, you should look at the links above and make your override function match exactlyn (and again, be aware that the C++98 and C++11 … | |
Re: If the file you are reading from is not sorted, you'll want to set up a container for all these records. Vector seems like a good choice. You'll read them all into the vector, then print them all. You can use Vector's built-in sort function or you can write your … | |
Re: Before commenting too much on the code itself, I want to make sure I understand what the goal is. This is an inventory management program, correct? The file you have listed above shows that you have four different products with names (Spritzer, Pencil, IPhone, GUNNAROPTIK) and corresponding ID (1,2,3,10). I … | |
Re: I've aways used the free ones in my hobbyist/private life. Every C++ IDE that I've had to pay for in the business world would have been free for the hobbyist. Visual Studio is now free for Hobbyist developers (Visual Studio, not just Visual Studio Express). NetBeans, Eclipse, and CodeBlocks arre … | |
Re: pritaeas's code seems efficient AND readable to me. You potentially have two calls to the Contains function in your original if statement. Your question seems to be asking if you can avoid the overhead of making a third call to Contains by doing something fancy, if I am reading it … | |
Re: A few possibilities. I'm not familiar with getkey(), but I imagine it gets called and the program stays there until a key is pressed, then it returns the key pressed. That's my assumption of the expected behavior due to the design of the loop. If that's your expectation, make sure … | |
Re: The wording in your program is a bit confusing. The user is supposed to enter a number from 1 to 50, representing the number of random numbers to be generated. However, the prompt says -10 to 10, the RANGE of the random numbers to be produced. I might run your … | |
Re: I'm seeing an uptick from both the Trump and Hillary camps in preparing for violent riots in the days before and after the election (people buying guns, stocking food and water, generators, etc.). These are mainstream folks, not apocalyptic survivalist types. I've also seen an uptick in wariness between the … | |
Re: I'm going to chime in with a bug-detecting technique rather than point out the actual bug. One, initialize your arrays with some printable value that is not in either file, like 'X' (as opposed to A,B,C,D,F). You want to get a printout of printable characters. It's tough to debug when … | |
Re: No password problems here, but I keep getting diverted to Dazah to re-confirm the permissions. | |
Re: The question IS a bit vague, OP. I figured out what you meant, but only after going through the code, seeing what was wrong, then going back to your words. Perhaps a better phrasing might be something like... ***I wrote a hangman program. There is a text file containing at … | |
Re: tallyLiveNeighbors appears to, at best, allow a total of one live neighbor. I imagine you want to change those "else if" lines to "if" lines. | |
Re: 42. The above answer is in lieu of a "Let me google that for you" link. | |
Re: > And too lazy to even ask a question. I had a professor who used to give out assignments like this. He would not provide the question that you were supposed to answer. Part of the assignment was that you had to think of what question could go along with … | |
Re: It crashes because you are using i instead of j in a couple of places. Look at line 28. As for the program as a whole, it's too complicated. You have an array of integers and an array of pointers to integers. The array of pointers to integers point to … | |
Re: Hmmmmm. Just submitted a long thoughful post and it went... I don't know where. I'm not typing it all out again. Bummer. It was a good one. OP, stick a space between your neighborCount output so you can see which digits make up which cells on the printout. cout << … | |
Re: > My question is, what is the correct way? Are you concerned about shallow versus deep copy? If so, don't be. C++ strings do deep copies or at least lazy copies (which you are not responsible for), so you don't need to be worried about shallow copies Both of your … | |
OK, so I know an 18-year-old young woman who just graduated high school. She'd not related to me, but she's the daughter of a very close friend, I've watched her grow up, and I'm sort of an Honorary Uncle since she has no uncles who are blood relatives. She mostly … ![]() | |
Re: You'll need to #include the cassert library. http://www.cplusplus.com/reference/cassert/ A valid row index will be 0 <= row < NUM_ROWS. So if a function is passed a parameter called row, you can stick this line at the top of the function: `assert(row >= 0 && row < NUM_ROWS);` For columns, substitute … | |
Re: Line 54: else if ( grade = 0.00 && grade <= 64.99) The dreaded = instead of == bug. = is the assignment operator. == is the comparison operator. I'm not exactly sure what you want in that line, but I am extremely confident you don't want the assignment operator. … | |
Re: > I can't see where x$ is used Same for the $result33 variable. It's used, but not inside the loop and for nothing but to figure out the number of times to go through the loop. Hard to say what the solution is here since I'm unfamiliar with the database, … ![]() | |
Re: Seriously? You're doing a dissertation for a Master's degree and you don't know how to spell "dissertation"? Or capitalize "I". Or end a sentence with a period. Also, "software" is one word. What college did you get your Bachelor's Degree from again? > Go away and do some work yourself. … | |
Re: > only 8% of our overall traffic is on mobile. Interesting. I would have imagined it was much, much higher. I'm about 50-50 myself regarding mobile browsing vs. desktop/laptop. Now for actually POSTING on Daniweb, I do that almost exclusively on desktop/laptop since I have no word processor or programming … ![]() | |
Re: RProffitt mentioned that you weren't using the right tags with your posts in one of your previous threads. I'm wondering if one of the tags should be "keylogger". You mentioned this as your goal in a previous thread: > What i am trying to do is make a "tamil" language … | |
I am pretty much brand new to Python. I'm cramming this week trying to learn it and I've been handed some code samples to try them out and familiarize myself with them. Problem is that they were written years ago in Python 2. It's my own C++ code that I … | |
Re: Line 17: $holidays = array('2016-07-22','2016-07-21'); In this particular case, these are two days, one after the other. But if you changed it, for example to: $holidays = array('2016-07-15','2016-07-22'); This is an array of two days. Line 23 checks whether a date is either July 15, 2016 or July 22, 2016. … | |
Re: > And Area 51 is meant to serve as a blog of sorts for what's new around here. How does one get to Area 51? I somehow got there by accident, but damn if I remember how and I see no way to navigate there. The name itself seems to … |
The End.