- Strength to Increase Rep
- +15
- Strength to Decrease Rep
- -3
- Upvotes Received
- 264
- Posts with Upvotes
- 215
- Upvoting Members
- 137
- Downvotes Received
- 8
- Posts with Downvotes
- 8
- Downvoting Members
- 8
CS Professor
1,362 Posted Topics
Re: Everybody should believe in something -- I believe I'll have another drink. -- W. C. Fields | |
Re: > (I am waiting for the resident gun nut to make an appearance and bring up the 2nd amendment - hehehe). I'm not going to go political and 2A here, but the gun handling on most every TV show or movie is horrible. The way people repeatedly pump the shotgun, … | |
Re: A Kinder Surprise (aka Kinder Egg aka Kinder Ei) | |
Re: OP - I don't see a problem with your code. I would hope by now you found it to work. Here's a pared down version of your problem, and it works fine for me. #include <stdio.h> #include <stdlib.h> typedef struct sortedDistance { int num; double distance; } sortedDistance; int compare( … | |
Re: Are variable a, b, c, s all integer types? What is the exact error message? sqrt( ) requires an argument that is a floating point type. Typecasting will be needed if your args are all integer types. | |
Re: Your function seems correct, as the following full example shows. What is in the array you pass to the function, and how are you passing it? [code] #include <iostream> #include <string> using namespace std; void searchString(string A[],int size, string target) { int j; for(j=0; j < size; j++) if(A[j] == … | |
Re: Harney Peak in the Black Hills of South Dakota is the highest point in the US east of the Rockies. | |
Re: First thought is that you should store the responses, and the correct answers, in arrays of type char. That way you could use a loop to compare responses to answers and quickly calculate overall score. | |
Re: The assignment does not seem clear as to how display should look. The count should be private, however, so you can't just display that in the main program. Add a display( ) method that outputs the count in a formatted manner. You can use division and the modulus operator (%) … | |
some problem with your computer just sort of fixes itself, and you don't know what was actually wrong or what made the problem go away? Case in point. On my main XP box, I could not get a proper connection to one of the networked printers in my home. Every … | |
Re: You appear to be defining a function (m2) inside a function (hang). I think it would be better if the function prototypes (lines 6,7,8) appeared before any functions. Oh, and when you make a comment in code, use //, not \\ | |
Re: First, your maxHeight needs to be a member of the class, so move it up. And it needs self as a parameter, like: def getX(self): "Returns the x position (distance) of this projectile." return self.xpos def maxHeight(self): time=self.yvel/9.8 self.maxheight=self.ypos+time*(self.yvel/2.0) return self.maxheight Then your problem with str( ) needs two fixes. … | |
Re: You should make an attempt to solve the problem first. Then, point out what's giving you difficulty, and we will try to help you find the solution. For your problem, start by writing out the steps you would take to do this by hand. What input do you need, what … | |
Re: My last three vehicles have been red. Just plain red. Going back to 1986. I don't know why, it's just worked out that the vehicle I needed/wanted to buy happened to be there, in red. | |
Re: There's your problem, reading a news article. With all the downsizing, proofreaders were the first to go. My grammar gripe lately is the improper use of apostrophes - people want to put them everywhere, needed or not. Most egregious misuse is in plurals. I see it so often, it's inadvertantly … | |
Re: I have a large format printer for which there was never a good XP driver - so I keep a Win98 machine. My main color printer doesn't always work quite right with some software under Win7, so I will keep an XP machine or two running. I may block them … | |
Re: [QUOTE=The Dude;520131]I wonder if putting them back on an ANALOG platform would also restore the FULL QUALITY of an analog stream.. (Records,etc)[/QUOTE] You can never go backwards. Lost data is lost. | |
Re: For starters, your input function can't make up its mind what it's supposed to do. [code] void fillArray(char a[], int size, int& numberUsed) { cout << "Enter up to " << size << " letters or characters.\n" << "Mark the end of the list with a negative number.\n"; int next, … | |
Re: Justin - what are lines 21-33 supposed to be doing? If you're trying to separate the units and the tens, you're over complicating the process. ArkM- your approach is fine, for a small number of numbers. What about the twenties, thirties....? Handle the special case of the teens Then do … | |
Re: Granted. And when the peasants revolt, you find they are really, really revolting. I wish I could become invisible. | |
Re: I expect to keep on using XP on a couple boxes pretty much forever, or until they die, whichever comes first. If I get worried about security, I'll block them from internet access. Right along with the Win98 box I keep. Have a couple pieces of hardware that wouldn't run … | |
Re: I find "scroom" to be quite useful these days. | |
Re: My first personally owned computer was also a Timex-Sinclair 1000 - with about all the add-ons I could add on. At the same time I was using Wang PCs at work and original IBM PCs (with both monochorme and color monitors attached) at the college. The mainframe lab had just … | |
Re: You appear to have most of it solved, just some little details to figure out. `while(inputFile.eof() && inputFile2.eof())` Assuming both files opened successfully, this line will keep any useful work from ever happening. eof( ) returns false every time until the end of file has actually been reached (attempt to … | |
Re: We need to see you do some work first. Or ask specific question on some topic or technique. We don't do your homework for you. OK, here's a start for you. Ask the user for number of scores. Declare a pointer to the type of data you're using. Allocate an … | |
Re: -5F. A bit brisk. No, really freaking cold! But, it is almost winter in the Black Hills. | |
Re: But Santa can still say "HO" when he's talking about toy trains under the tree. | |
Re: wwjj - the problem with referring to (and responding to) old threads is that the answer that once was right may not still be so. Recent changes to the C and C++ standards allow for variables as array size declarators. Depending on the compiler you use (GCC does suppor this), … | |
Re: You'll need to better define the problem. Do you mean to take in words that define a number, like "two thousand forty five" and convert to digits, 2045? Or to take in a numeric value, like 2045 and display as separate digits, 2 0 4 5? Once you have the … | |
Re: Visual C++ has lots of online help available. Click on an object or reserved word and press F1. You also get many autocompletion hints as you write the code. | |
Re: In C++ today, the only significant difference between a struct and a class is the default access - struct, all members are public, class, they're private. So you could rename your struct as a class, and then include it as a data member of a larger class. Or leave it … | |
Re: The for loop runs four iterations, so count gets incremented by one four times. count goes from 0 to 1 to 2 to 3 to 4, then is displayed. The while condition is still true, so the for loop executes again: 5,6,7,8, display. While condition still true, so for loop … | |
Re: It really helps to have some reasonable indentation to see what's what. Here's the code, formatted better. #include <cstdlib> #include <ctime> #include <iostream> using namespace std; int findSmallestRemainingElement (int array[], int size, int index); void swap (int array[], int first_index, int second_index); void sort (int array[], int size) { for … | |
Re: We don't do your assignments for you - read the stickies at the top of the forum. Write some code, if you have questions, post the code, be direct in what you're having problems with. | |
Re: As I interpret that code, only the last of the Fib numbers will be in the file. You open it inside the loop, write a number, close the file. The next pass through the loop will open the file, truncate the existing file (that is, delete previous content) and write … | |
Re: Within the context given, the new character could be placed in at least a 2 element char array, with a null terminator, making it a string. Then concatenate that. That would also require that the target array be made a valid string at declaration. #include <iostream> #include <conio.h> using namespace … | |
Re: You declare a small array in main. The read_file declares and fills a large array. Back in main you pass that small, empty array to the search function. There's nothing for it to search. How about: int main() { employees array[1000]; read_file(array); search(array); return 0; } void read_file( employee array[] … | |
Re: Would you please visit Vanna White and buy some vowels? You will get better help when you write in a readable manner. Text-speak is not conducive to technical communication. </rant> | |
Re: A few obvious things. You need to have the input statements (lines 9,10) repeated at the end of the loop to get the next input from the user (insert after line 33). Don't increment count in the loop, if it is to be your input value. Personally, I'd use a … | |
Re: It really helps if you tell us the error message you get, and what line it points to. In your case, it looks to be a very simple fix - you need to include the string library if you want to use the string type. `#include <string>` And strictly speaking, … | |
Re: I just used your code, and with shift of 4, the Caesar array is: efghijklmnopqrstuvwxyzabcd Just what it should be. What are you seeing as a problem? | |
Re: Because `value` is a pointer to float, not a float. | |
Re: If you want to shift the values in an array, you have to be careful what you're doing so that you don't lose anything. Simplest approach might be to simply write code that shifts by one. Take item from the end being shifted out, store it. Move the item came … | |
Re: You could create an array or vector that holds each of the 6 words. Then the random number you generate is used as an index into that array to display the appropriate word. Also, using those three random numbers will allow you to shorten your comparison tests for winning combinations, … | |
Re: Tablets have their place for consumption of content, and lightweight (very lightweight) productivity use. But for really doing work, I don't see the desktop or mid-to upper end laptops going away. Tablets don't have the storage, the power, the ergonomics of usage that a full up machine has. The content … | |
The End.