1,857 Posted Topics
Re: This is close to impossible since that code won't compile as is and it references objects that are created elsewhere. | |
Re: [Article](http://www.codeproject.com/Articles/28107/Zip-Files-Easy) about zip files. [Article](http://en.wikipedia.org/wiki/Resource_Description_Framework) about RDF specifications | |
Re: Replacing the file stream with a memory stream should do the job: MemoryStream stream = new MemoryStream(); BinaryFormatter seri = new BinaryFormatter(); foreach (Object p1 in list) { if (!isContained(p1, toRemove)) { seri.Serialize(stream, p1); } } | |
Re: A few things: - Instead of doing this - `int i=0,j=0;`, `int result,answer,x,y;`. It's much more intuitive to use descriptive names. It also helps readability to declare variables on separate lines: int result = 0; int answer = 0; int mult1 = 0; int mult2 = 0; int score = … | |
Re: Just an FYI, a [bitset](http://www.cplusplus.com/reference/bitset/bitset/) is specifically designed to handle this sort of thing. int main() { int num; cout<<"decimal\n\n"; cout<<"to binary\n\n"; cout<<"Enter a nonnegative integer:"; cin >> num; //provide the number of bits to use bitset<16> binNum(num); cout << binNum <<"\n"; system("pause"); return 0; } | |
Re: The problem appears to be that you aren't telling `filename` whether to open the file for extraction or insertion. You need to combine fstream::out with fstream:app with the bitwise OR operator: filename.open(logfilename.c_str(), fstream::out | fstream::app); | |
Re: If temporary variables are also not wanted and you're only going to use integral types, you can use the additive swap method: int a = 3; int b = 5; a = a + b;//a=8,b=5 b = a - b;//a=8,b=3 a = a - b;//a=5,b=3 | |
Re: Probably one of the simplest ways is to design the class the way you want it, then put it into a new project. Now export that project as a template(File-Export Template). Any time you want to make a project that uses that class, that template should show up in the … | |
Re: The last error message won't display the same time as the second one, because, the second relies on radbusiness.checked being false and the third relies on it being true. | |
Re: Does the input have to be a string? If you make it an integer then you just need to check that the value(v) 999 < v < 10000 | |
Re: Your not checking for when the file is at the end properly. Something like this should work: case 2: int b=1; //When the stream can't read any more data it returns false while(xyz>>std.id>>std.name>>std.marks) { cout<<"record no is: "<<b<<endl; cout<<"id is: "<<std.id<<endl; cout<<"name is: "<<std.name<<endl; cout<<"marks are: "<<std.marks; b++; } break; | |
Re: Are you using begin() or cbegin()? begin() should be a bidirectional iterator. Basically assign it to an iterator instead of a const_iterator and you can change its value. | |
Re: There seems to be a bug. It doesn't return the segment after the last token(e.g. "9/7/2011", returns "9" and "7" only) | |
Re: Your code begs the questions: Why convert text to string when it's already text? What does the `unformat` function do? Also if the `unformat` function is necessary why isn't it returning a string? | |
Re: One option you have is to use the TotalDays, TotalHours, TotalMinutes, TotalSeconds, or TotalMilliseconds, depending on which scale you're mainly interested in. Each of these methods returns a Double. There are equivalent From methods that will convert back to a TimeSpan object. Another option is to use the `Ticks` property … | |
Re: 2 immediate problems I see with your `file_input` function, is the closing brace is missing and you're trying to access a variable that doesn't exist, `s1`. Aside from that and assuming the data for each stack is on separate lines in one file and that you intend for the stack … | |
Re: You're missing the opening brace for the `watch` class. This will highlight other errors: Line 41: you have the wrong extraction operator it should be `>>`. Lines 50 & 61: You put a 1 instead of an l at the end of `endl`. Line 70: the label ED doesn't exist. … | |
Re: At first glance it looks like you're missing a loop. As it is the code only runs through once. Here's a simple way to use a loop: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class TestClass1 { static void Main() { bool Continue = true; string … | |
Re: The example on this [page](https://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.print%28v=vs.110%29.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1) shows how to print multiple pages. | |
Re: A few other things to think about: Try to avoid using global variables. On a big project it's easy to lose track of which functions are modifying the variable. A struct is probably redundant for this, since the index of an array is the number and the value can be … | |
Re: I'm thinking that part of your problem might be compiler specific. I can't get the same output from your code. However, there are some issues that I noticed. Reading the first line from each file shouldn't work right with the extraction operator(`>>`), since that will use the space as a … | |
This is a very simple login form. I set it up so that the form won't close until it's cancelled or a valid username and password are entered. I chained the check for the username and the check for the password, so that if the username doesn't pass the password … | |
Re: Your main problems appear to be in `func_count`. you didn't declare the return type, which in this case should be `void`, since that is how your prototype has it declared. Also,the 2 variables you have in that function are `count2` and `count5`, however your `printf` statement is trying to print … | |
Re: In addendum to that, don't be afraid to search the post archives. You'll find that most of your problems aren't unique and someone else has already asked and received and answer for it. | |
Re: The character appears to be Unicode &H2640 | |
Re: I would suggest some refactoring. A class(`Board`) can help keep the calculations separate from the event handler code, simplifying it tremendously: Public Class Board Public type = "" Public hrRate = 0 Public dayRate = 0 Public hoursRented As Integer = 0 Public daysRented As Integer = 0 'This is … | |
Re: I suspect the main problem is on line 8. However without the listing of the `unorderedArrayListType` class it's hard to say for sure. | |
Re: If you must use one form you can make the Admin controls unique, maybe have them in a panel. Now it's a simple matter of making the panel disabled and invisible to disable the the admin controls. | |
Re: You didn't follow your own example, in the default case, and add the subsequent methods to operation. Also in the default case you re-initilize operation without running it: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; delegate int OperationDelegate(int a); namespace DelegationLAB { public delegate void OperationDelegate(int a); … | |
![]() | Re: For this LINQ probably isn't the bext choice. Since you aren't really creating a collection just modifying one, a simple `foreach` loop would probably work better. Also you would probably find it easier to work with `System.Xml.Linq.XDocument`: void SetButton1Attribute(string fileName) { XDocument xdoc = XDocument.Load(fileName); XElement rootElement = xdoc.Element("Table").Element("GroupPermissions"); foreach … ![]() |
Re: In C++ you either have to put the functions before Main or use prototypes at the beginning of the file. If this is new to you, you should probably review your instruction materials, as this is fairly basic to C++ programming. | |
Re: One workaround that doesn't require registry hacks is to embed the browser itself in a container control, like tab control. ![]() | |
Re: Your code appears to work as is. You'll have to describe more fully what the specific problem is | |
Re: I would suggest that `XmlSerializer` would be the way to go here. First make sure that all the properties you want to save are public and that you have the get/set added. Next to make sure that the columns display the headers that you want for each property, add the … | |
Re: Another minor point, you tell the user you're using integers but you're using doubles. A side note,multiplying the second term by -1 will change the operation from addition to subtraction. This is helpful in that you can now use 1 function to do either operation. | |
Re: You're putting semi-colons(;) where they don't belong. They are needed in the function prototype but not in the function declaration. `if` statements don't take semi-colons either. | |
Re: In the foreach, you're trying to use the FileStream,`footballFile`, as a collection. I think you meant to use `leagueInfo`. On a side note arraylist is not the best choice for this as it stores each object as an object not the type you want. I would suggest a `List<FootballTeam>` instead. | |
Re: The FileStream hasn't closed the file yet. Therefore the length hasn't been determined. Try wrapping the Filestream block in a `using` block. This will automaitcally close the stream and the length can then be determined: using (FileStream fs = new FileStream("random.bin", FileMode.OpenOrCreate, FileAccess.ReadWrite)) { // has to be declared in … | |
Re: When you start the external app on the desktop, are you using a shortcut? If so, is the shortcut passing a parameter to the app telling it to check for updates? | |
Re: Assuming the text is in a standard format the [DateTime structure](https://msdn.microsoft.com/en-us/library/system.datetime%28v=vs.110%29.aspx) has a TryParse method to convert text. The DateTime structure allows you to extract any or all parts of the date and/or the time. | |
Re: the [BinaryReader Class](https://msdn.microsoft.com/en-us/library/vstudio/system.io.binaryreader%28v=vs.100%29.aspx) and the [BinaryWriter Class](https://msdn.microsoft.com/en-us/library/System.IO.BinaryWriter%28v=vs.71%29.aspx) help pages both have examples and/or link to pages with examples. | |
Re: The Arraylist is empty, because you start with a new one each time you get input from the user. Declare it just before the start of the while loop. | |
Re: Could add some sample data and how you expect the code to operate on that data? | |
Re: probably an even more simple solution would be to replace the column headers in the second table with the values from the first. Something like this should work: var columnArray = dataset.Tables["headers"].Rows[0].ItemArray[0].ToString().Split(','); for(int i = 0; i < columnArray.Length; i++) { dataset.Tables[1].Columns[i].ColumnName = columnArray[i]; } This assumes that the number … | |
Re: The simplest is to create a .csv file which excel is capable of reading. This way you avoid any extra API's or librairies | |
Re: Your problem is that `div` is re-initialized each time the function runs, leading to a stack overflow error. Making `div` an optional parameter with a default value of 2 and passing the new value at each recursion, is one way around this: void printFactors(int n, int div = 2) { … | |
Re: Visual Studio 2010 doesn't fully support C++ like the other languages. I'd suggest online tutorials to learn C++ | |
![]() | Re: First you'll need a custom comparer, something like this: public class CustomComparer : IComparer<char> { public int Compare(char x, char y) { //If the leading characters are both letters or both digits //then sort normally if ((char.IsLetter(x) && char.IsLetter(y)) || (char.IsDigit(x) && char.IsDigit(y))) { return x.CompareTo(y); } //If they aren't … |
Re: The error tells you exactly what is wrong. You don't tell the compiler what the code inside the braces means. You need `return type Name(arguments)`. | |
Re: If the comments you added are supposed to be the answers you want, then no they are not all right. Line 11 gives the right answer the rest give different answers |
The End.