2,045 Posted Topics
Re: Rather than working from a clean slate, post up the code that you have now. It's unfortunate that those other forums didn't meet your needs, but you're coming across as a little bit demanding. I know that you don't know everything, but in order to help you, rather than do … | |
Re: Mixing cin and getline like you do can cause problems. Since you press enter after entering in userInputString and cin does not take up that resulting '\n', it stays in the stream and gets taken up by the getline (and interpreted as the end of the input, so control appears … | |
Re: [code] int get.a(a); [/code] is not correct, and shouldn't be associated with the getcoefficients() method. The period indicates a member variable and shouldn't be used in a method name like that, just make it [icode] int get_a or geta etc. [/icode] Also, your notation is incorrect (it looks a bit … | |
Re: See the example on the bottom of this page [url]http://www.cplusplus.com/reference/stl/vector/erase/[/url]. You'll have to add an offset to .begin() to index in. So to erase the 6th element [icode] vectorGameList.erase(vectorGameList.begin()+5);[/icode] | |
Re: Your romanNum in main is just one character. I'm assuming you're going to want to convert more than that. setRoman is incorrect, you have no variable name for the parameter and it doesn't really do anything. If you are using C-style strings, look into functions in the <cstring> header like … | |
Re: Take in product code as a string rather than an integer, and then verify that all of the characters in the string are digits. Just as an aside, why are you passing in the value for product code into the function if you're just going to ask the user to … | |
Re: Before you start to do it all by hand, take a look at something like this [url]http://msdn.microsoft.com/en-us/magazine/cc163991.aspx#S3[/url]. There are mechanisms in place for internationalization of your application and you can keep the strings right in the ResX file now, rather than using an external config file. Otherwise, split the strings … | |
Re: You never reassign bodyPos[c] [I]to[/I] bodyPos[a], there should be a third line to your swap on line 6-7. | |
Re: I hate to tell you this, but you're going to have to narrow the code down dramatically and present questions about specific sections because someone is not going to go through and check all those steps for you. | |
![]() | Re: dynCurrentTime->Now is a handle to a DateTime object? (DateTime ^) or? If not, I would just declare a regular DateTime object: [code] DateTime time1,time2; time1=dynCurrentTime->Now; etc. [/code] Then you can use the overloaded < > == operators. |
Re: [icode] Console.WriteLine(prime.ToString() + " - Prime"); [/icode] You left your C# hat on... :) Only kidding. He/She also needs to check the numbers to see if they are palindromes too. OP was trying to just check the first and last digits but for a 4+ digit number this will probably … | |
Re: Is your assignment to write the solver or simply to solve that set of equations? If it's the latter, just use [url]http://www.mathworks.com/help/techdoc/ref/rref.html[/url], it's essentially doing the same thing by a slightly different method. | |
Re: [quote]amirite?[/quote] No, because you're not always going to have someone to take you through a project step by step before you have to do it. You likely have a textbook and certainly have the internet if you don't know how to do something. No one is going to give you … | |
Re: Look into a DateTime object: [url]http://msdn.microsoft.com/en-us/library/system.datetime_members(v=VS.90).aspx[/url] Create an instance of a DateTime object and set it equal to DateTime::Now, then just use the hours, minutes, seconds members to get what you need. If you want it to update every second, use a Timer object. | |
Re: You're going to have to write out the error messages because most people don't know the error codes off the top of their heads. | |
Re: I was just playing around with it, but in case you're interested [url]http://www.codeproject.com/KB/cs/DraggableForm.aspx[/url] also works (you need to change the Point * (as it's old) to regular Points to get it to play nice. Glad you found a solution | |
Re: If you are doing plain C++, you should select a project of type Win32 Console application, rather than a CLR/console. Otherwise it's going to be more of a hodgepodge than necessary (unless you are really looking for that functionality). Check the "number" to see if it's less than 20 (using … | |
Re: [quote]- Compiling in Terminal [/quote] What is the command you are using to compile? You need to put both .cpp files in the command. [icode] g++ myclass.cpp mymain.cpp -o myprogram [/icode] (assuming you're using gcc). | |
Re: The numbers you are looking for are surrounded by spaces (or in the last case by space and the end of the string). If you hit a space and the next digit is a number, start converting until you hit another space(or the end of the string). | |
Re: Please put some code tags on your post. There's still time to edit. Click the Edit button underneath your name and surround your code by [noparse][code]//code here[/code][/noparse]. | |
Re: Just to throw this out there: what if you read all the data for one car into a List<string> and added that to a List<List<string>>? Add the first member of each list (the VIN) to the combobox, then use the SelectedIndex of the combobox as your index into the List<List<>> … | |
Re: [quote]anyone here? [/quote] Please have some patience, the person who ultimately answers you question may be sleeping now. Have you run this function through a debugger to see exactly when it crashes? | |
Re: Is the number of test scores something that you can prompt the user for? If so, use a dynamic array: [code] std::cin >> numscores; int * scorearray = new int[numscores]; [/code] | |
Re: Make sure the textbox is set to multiline. To append your text to what is in the box, use the += operator. In your loop: (obviously read the line of text into a temporary if you're using .ReadLine() to drive the loop) [code] myTextBox.Text +=(myStreamReader.ReadLine()+"\r\n"); [/code] I didn't test that … | |
Re: Purely based on the C/C++/C# forums, nothing drastic yet, honestly. | |
Re: This is a good thread on SO about it: [url]http://stackoverflow.com/questions/628526/is-short-circuiting-boolean-operators-mandated-in-c-c-and-evaluation-order[/url] Both are short circuiting, so since your first operand of || was true, it skipped the foo() call in the first example. | |
Re: [quote]So that 'AC' becomes (('A' - 'A' + 1) * 10) + ('C' - 'A' + 1) which is 10 + 3 = 13 [/quote] Except that AC is actually 29 (after Z comes AA, AB, AC, etc.), so for AA to be 27, A has to be 1 (you'd … | |
Re: Glancing through, it didn't seem like anyone has pointed out to you yet that [code] if (200 <= sales[i] <= 299) [/code] should be [code] if(sales[i] >=200 && sales[i] <=299) [/code] The first version may compile as a statement, but it isn't going to resolve properly. The same for your … | |
Re: This [icode]int getMetaData( int dataFlags[], int dataSize);[/icode] is making another prototype of your function in main, and (I believe) overshadowing your prior definition of it). Go back and look over your text as to how to call a function properly (hint, you don't need the data types in the call … | |
![]() | Re: Keep a running total in a double variable. Add the ticket price into that total within each of the cases of the switch statement, like right after you set the seat to reserved (note that you want to make sure that you're only charging once per ticket). In other words, … ![]() |
Re: He's using .NET (C++/CLI). OP, you should specify this (at least that you are using a Winforms project). MSDN has great pages on all of the controls. You'll find that you need to change the BackgroundImage (and probably the BackgroundImageLayout). [url]http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox(v=VS.100).aspx[/url] | |
Re: You're not returning anything in your function, which is supposed to return an int, so any information in c_charg is lost. Also, where does area come from? You need to declare this in the function and calculate it with the length and width that are being passed into the function. … | |
Re: With your project open, go to the Project menu, <ProjectName> Properties, Configuration Properties, C/C++, Additional Include Directories, and add in where your header files reside. Then also under Configuration Properties, Linker, General, Additional Library Directories, add the directory where the libraries reside. Then Configuration Properties, Linker, Input, Additional Dependencies, add … | |
Re: Why do you have more than one main()? See if you can organize these around one main, and then someone can help you figure out how to fill in the blanks. | |
Re: It's choking on reading the true or false values. When reading a bool from a file it's looking for a 0 or (EDIT: only works for 1) a 1 as false and true. Read in "true" or "false" from your file as a string and then convert it to boolean … | |
Re: If there are less than 10 choices, take in the choice as a character rather than an integer. Check to make sure the character is between '1' and '9' (or '0' and '9' if you want a choice 0). Alternatively, if a 2+ digit answer is required, take in the … | |
Re: Note that it's "endl" with an 'L' Take in your X and Y (you can't read into a algebraic relation like X+Y), also note that "x" as an identifier is different from "X". Do the program a step at a time. Firstly, make sure your include directive is complete (you're … | |
Re: I'm assuming you are required to use the c-strings? Check out strtok [url]http://www.cplusplus.com/reference/clibrary/cstring/strtok/[/url] (using the comma as a delimiter) Also, [U]never[/U] use gets(), you can overrun the buffer by a mile and corrupt the neighboring memory. Use fgets instead so that there is a fixed buffer size. | |
Re: If you had specified a size for the vector in main, what you did could work, but since it starts off with an unspecified size you can't index into it. [code] string tempstring; while(i < MAX && in >> tempstring) { str.push_back(tempstring); i++; } [/code] You should also pass the … | |
Re: Create a DateTime object and use comparisons( <. >,==, etc.) with the current date: [code] DateTime vernalequinox(2011,03,21); DateTime summersolstice(2011,06,21); //or whatever it is if(DateTimePicker->Value >= vernalequinox && DateTimePicker->Value < summersolstice) MessageBox::Show("Spring!"); [/code] I'm not very familiar with CEST and CET, but I assume they change over on certain dates. You … | |
Re: What is contained in the input file? Also, your function from 55 onwards doesn't have a return type, name, or parameters. | |
Re: There is no standard functions to do this. You will need a library like OpenCV (or possibly something in DirectX, though I'm not sure of that). If you are just starting in C++, it may be too complicated to dive right into getting something like that to work with your … | |
Re: [quote]Also I'm using VC++ for this.[/quote] I assume you're using a CLR/Winforms application? Check out [url]http://www.daniweb.com/forums/post1126074.html#post1126074[/url]. There's some extra info in there pertaining to troubleshooting that particular case, but note the classes and the setting that the OP used. | |
Re: I'm assuming you're using a CLR/Winforms setup. If so, see [url]http://www.codeproject.com/KB/IP/httpwebrequest_response.aspx[/url] for a good example (the example's in C#, so you'll have to convert the syntax, subbing :: for the C# . that indicates namespace resolution and -> for the . that indicates member variable). HttpWebRequest is the class that … | |
Re: On line 1 of your second code listing of the first post, you still need the datatypes for str and level in the constructor definition [code] dragon::dragon(string str,int level) { [/code] | |
Re: I'm not as familiar with strtok, but you should try passing in [icode] line.c_str() [/icode]to it instead of the address of the first character on line 14. What you did assumes something about the implementation of the std::string which may not be true. Either way, you seem to be getting … | |
Re: You're making life difficult on yourself: Define a variable max, set it equal to the first element of the array Step through the array, if the current element in the array is greater than max, let max be equal to that element, and set temp = index. Only change the … | |
Re: Yes, you would want a dynamic allocation. In C++, a fixed-size array's size must be a constant known known at compile time. You need [icode] int * myarray = new int[sizeofarray]; [/icode] Since the array is dynamically allocated with new, you need to delete it to free up the memory, … | |
Re: Use strcmp in the <cstring> header. You can't compare two C-strings using ==. [code] if((strcmp(string1,string2) == 0) cout<<"Strings are the same"<<endl; [/code] Easier would be to use cin.get to read in a character and compare it to 'Q' |
The End.