1,426 Posted Topics
Re: what compiler are you using? if you are using msvc++ you have to pick a win32 console application. | |
Re: You are trying to initialize a 2d array when you onlty declared a 1d array. You can change it to char arrayOnes[][10] = {"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"} If you can use strings I would suggest doing this std::string arrayOnes[10] = {"", "one", "two", "three", … | |
Re: do you know the % operator? do you know how to use an loop? do you know how to use an array? those are really all you need to figure this out. | |
Re: you need a closing brace on line 704. you also would benifit greatly properly indenting your code. | |
Re: There isnt a way to add commas to the output natively but you can wrtie a function to do it for you. | |
Re: I am amazed that people don’t even try to Google for an answer. Most of the time the first page has the answer and so much more. | |
Re: Yes a `char*` is a pointer to a char that can be modified. a `const char*` is a char pointer that cant be modified. | |
Re: Well if you want to store the sentance in a variable use a string not a stringstream. Your code would look like this string line; getline(cin, line); // gets the sentence from the command line and place it in line cout << "You Entered: " << line << endl; | |
Re: We don't do homework. What code do you have so far? | |
Re: Can you narrow down where the problem is. I'm not going to read ~1000 lines of code to find the answer. | |
Re: The first thing I would do is name your variables something descriptive. I'm not sure of the rest of the people on this site but if your code isnt somewhat easy to read I'm not going to make the effort. | |
Re: @ sanyam.mishra `char* argv[FILENAME_MAX]` is an array of pointers so it is a 2d array. @ DarrelMan have you walked through the code with the debugger to see what is inside argv[0]? If you dont know how to step through the code with the debuger you could just output the … | |
Re: Sure you can do this with c++. You will need to know how to use [file streams](http://www.cplusplus.com/reference/fstream/fstream/) and [strings](http://www.cplusplus.com/reference/string/). | |
Re: add this after line 14 to see if your file is being opened. if(!myfile) std::cout << "Unable to open file" << std::endl; | |
Re: Passing by reference or value should be pretty much the same for POD types. In this case your struct only contains POD types so passing the struct by value or passing all of the variables by reference should be the same. If you want to you can pass your struct … | |
Re: Not to pick nit but shouldn't line 35 be `delete [] p;`, since the first level of p is in itself an array? | |
Re: where are you getting a value for hwndDC? does hwndDC hold a handle to the window of the game you are trying to hack? | |
| |
Re: If I was doing this I would read each line of the file into a string array. After that I would go through each string in the array and insert a `b` in front of every `B`. Then I would just overwrite the contents of the file with the modified … | |
Re: @AD Wont the compiler see that the value of the expression never changes and optimize it away? | |
Re: It is not the same thing Sales::Sales() { double sales[] = {0.0, 0.0, 0.0, 0.0}; } The above code creates an double array called sales in the constructor which hides the sales array that is a member of the class. Once the constructor is done this local array that has … | |
Re: #include <iostream> int main() { std::cout << "Hello World!" << std::endl; std::cin.get(); return 0; } | |
Re: give [this](http://www.daniweb.com/software-development/cpp/threads/90228/flushing-the-input-stream) article a look. | |
Re: >This is a C++ program that reads as input a text file. Where? I didnt see one. | |
![]() | Re: >program does not work: Can you alaborate a little more than that? Your fist for loop needs to have its statements wrapped in brackets since there are multiple lines. for(int i = 0; i < 7; i++) { //code here //code here } You are never multiplying the total by … ![]() |
Re: Well you can take the number in as a string and make sure that there is only 1's and 0's in it. | |
| |
Re: Change line 11 to if (std::string::npos == (pos = temp.find("x^2"))) | |
Re: how does the >> operator work for your `Polynomial` class? I ask because if you use getline inside the `Polynomial` class then `cin >>` will be throwing you off. What happens if you put `cin.get()` between lines 34 and 35? | |
Re: So you need to find some group of 3 items that has the same type and the highest sum of thier values? If that is the case then I would split you main array into seperate arrays for each type. Then sort those arrays in descending order. Then find which … | |
Re: Want to post the code you have? | |
Re: Not with that amount of information. What are you trying to do? Is this a code problem? I know a picture is worth a thousand words but I think the words would do a better job of explaing what you are trying to do. | |
Re: So what do you have so far? Do you know how to use a [string](http://www.cplusplus.com/reference/string/string/)? The `find_first_not_of()` function can be really helpful. | |
![]() | Re: On line 4 you declare `o` as `int *o=new int;`. This ony gives you a single int pointer. So when you call line 16 you invalidate the pointer because you step out of the memory allocated to it. It looks to me like you need `o` to be an array. … ![]() |
| |
Re: This is sudo code but you shoud be able to get it to work for index = startIndex to index = endIndex print array[index] | |
Re: Um? You resurected a 4 year old thread about C++ to post Java code? | |
Re: [floor(](http://www.cplusplus.com/reference/cmath/floor/)) rounds down to the nearest integer. | |
Re: You are not passing any variables to your functions. Since you want to update what the values of the variables are you need to pass them by reference. You also need to get rid of the declerations of win, lose and tie in your functions. `displayWinner()` should look like this … | |
Re: I like your description of java rubberman. I fell the same way. | |
Re: line 49 needs to be: temp = temp + (data[i] * x.data[i]); If you are mulitplying each vector element agianst the other. One issue I see is how are you going to handle mismatched vector sizes? | |
Re: What all is in word? is it just one word or a sentence. I ask because I dont know of a word that is 40 letters long outside of chemical compounds. How do you want to split the word? If the word puts you over 40 charecters do you split … | |
Re: [stoi()](http://www.cplusplus.com/reference/string/stoi/?kw=stoi) is overloaded to take a string or a wstring. | |
Re: Well if you can use the string classs the you can use the [find()](http://www.cplusplus.com/reference/string/string/find/) method to look for the word include. Then parse from there to make sure it is correct. | |
| |
Re: That is some pretty bad to code to resurrect a 5 year old thread with. | |
Re: Where are the `swt()` and `iswt()` functions declared/defined? Are they in the wavelet2d.h header file? |
The End.