2,045 Posted Topics
Re: What have you tried so far? Have you tried out an example with paper and pencil to get the thought process (which makes it much easier to code)? Also please see this: [url]http://www.daniweb.com/forums/announcement8-2.html[/url] | |
Re: Do a quick net search for "given an infraction." It's a widely used, do I dare say, idiom. Language revolves around usage. From a practical standpoint, in the scheme of things it probably does not matter one bit. ![]() | |
Re: Go to the designer in your application and click on the Form1 window (or whatever you named it). Go to the properties menu on the right (if it's not there go to View/Other Windows/Properties Window. Click on the lightening bolt to get to the events. Go to load. Double click … | |
Re: Next time please use the code tags [noparse][code] code goes here [/code][/noparse] Why do you declare choice after you try to write to it? You need to move [icode] int choice = 0;[/icode] before [icode] std::cin >>choice; [/icode] | |
Re: You have to make a decision based on the options Lerner gave you in the last paragraph. At this point there is no right or wrong answer. At that point make a function skeleton like: [code] return_type myfunctionname(type param1,type param2) { } [/code] See how much of it you can … | |
Re: What are you typing in to execute the program you've written? | |
Re: Use a stringstream object: [code] #include <sstream> //... stringstream ss; double value = 10.4567; ss<<value; string valuestr = ss.str(); [/code] There are certainly other methods that will work but this one is more straightforward IMHO. | |
Re: EDIT: Ignore the other part about ostream. Since n and d are private members, you must access them through some kind of "getter" function. If they were public you'd probably want something more like r.(*n) instead of the way you have it (you can't dereference r as it is not … | |
Re: Looks like there are a couple of methods. I didn't play around with it much further than this: [code] array<Point>^ ptarray = gcnew array<Point>(3); ptarray->SetValue(Point(0,0),0); ptarray->SetValue(Point(1,1),1); ptarray[2] = Point(2,2); [/code] | |
Re: You're not too far off. With c-strings (strings terminated in '\0' as opposed to std::string which I'll get to in a minute) the variable is essentially a pointer, so saying [code] char * str1 = "Hello"; //a '\0' is automatically appended at the end of each of these char * … | |
Re: [quote],use "b"and"d"variables for base and decimal respectively. [/quote] Wow, well... if you've gotten [I]that[/I] far with it then by all means. I was kind of thinking of going with b for decimal. I'll have to go redesign... | |
Re: I don't have any experience specific to this area but a search over at [URL="http://ieeexplore.ieee.org/Xplore/guesthome.jsp"]IEEE Explore[/URL] turned up quite a few results. You can read the abstracts and usually find the author's website if something interests you (the articles without a subscription are costly, unfortunately). | |
Re: I have done this in C# but it seems to be a bit different in C++/CLI. I found [URL="http://stackoverflow.com/questions/1565142/what-is-the-simplest-way-to-display-and-change-an-image-resource-on-a-wpf-dialo"]this page[/URL] which describes a method but I don't know if it's the most effective. | |
Re: On line 11, you're adding the same value (one past the end of the array, not what you want) over and over again. You want to add [icode] a[i] [/icode]. Double check your for loop there too, count the number of elements that loop will step through. | |
Re: void getProbsPerSet(int probsPerSet) should be void getProbsPerSet(int & probsPerSet) to pass in the reference to your variable. The way you had it your cin >> value was falling into the vortex. There are a lot of things in the rest of it that I'm not honestly sure what you are … | |
Re: I was able to get something like this to work: [code] string value = "a, ,b,-,c,d"; string[] text = value.Split(','); //change it to a list List<string> texlist = text.ToList(); texlist.RemoveAt(i); //use a loop and the RemoveAt() method [/code] I couldn't find a way to do it on the array directly … | |
Re: You have a kind of hybrid declaration/definition there on 22 which is incorrect. Change it to look like a method definition without the ; and with (). Of course add any parameters to the method that you need. | |
Re: [QUOTE=caut_baia;1200990]You should use a switch statement [code] char letter; while (cin>>letter) { switch (letter) { case 'd': case 'D': case 'e': case 'E': //code here break; } } [/code][/QUOTE] There are two different variables in the OP's if statement, your approach will not work. | |
Re: A quick hint. In the function that starts on line 38 you create one file stream, then create another, only open a file in the second one and then try to write to the first one. It's ok to be frustrated but take a step back and ask if what … | |
Re: Use a 2D char array to hold the lines. This works best when you know roughly how many lines and how many characters in each line. Then use fgets to read them into the array one by one. | |
Re: [QUOTE=serena5;1201820]Oh trust me if there was such a book, I would have found it by now, lol. [/QUOTE] If you're also looking into designing IDEs that you can use with an existing compiler check out [url]http://damieng.com/blog/2007/11/08/dissecting-a-c-application-inside-sharpdevelop[/url] -- the book is free and legal. | |
Re: Make a list of string arrays and add them to the list in the order that you add the classes to their combobox. Note in this case that comboBox1 is your classcmbo and comboBox2 is the other one. [code] List<string[]> strlis; public Form1() { InitializeComponent(); //add your class strings to … | |
Re: [QUOTE=tonymuilenburg;1201051]Ah, I see you just got the bracket in the wrong place. There is also a comma after int that should not be there. Here it is cleaned up: [CODE] //... cout << endl; } return 0; } void DivideArray(int table[6][5], int theMatrix[6][5], int, int) <----- { for (int i=0; … | |
Re: When you are entering a char it's causing the input stream to go bad. I would think clear() would take care of it but I wasn't able to get it to work. There's got to be some other trick to it that I'm not aware of. The simplest solution is … | |
Re: If you hit the set button and then you hit the calculate button it's going to set bags of feed to 5 (see your button2_click handler). In order for the program to change farmer.NumberOfCows on line 28 of the first file you must move the numeric up/down to a new … | |
Re: Check to see if it's still running somewhere (if it's not in the taskbar, open the task manager and see if it's still there, end the process if it is). Failing that try rebooting. If that still doesn't help you might have to create a new project and incorporate the … | |
Re: I think you need a slight redesign. Perhaps I'm misunderstanding your intentions but you are making an array of 20 strings but each entry will take up 6 of those strings. You'll only have 3 records. I would make a list of string arrays that are each 6 elements long. … | |
Re: Put in a [icode]cin.get();[/icode] at the end of your code, before your return statement in main(). If the get() is being falsely triggered by an excess character in the stream, put in a [icode]cin.ignore()[/icode] before the call to get(). | |
Re: [QUOTE=iammfa;1200443]Hi, my code: [CODE]#include <iostream> #include <iomanip> #include <conio.h> //leave this out, it's nonstandard using namespace std; void main() { int i=32; for(i=32; i<=256; i++); //something extra on this line cout << setw(0) << "value" << setw(14) << "character" << endl; cout << setw(0) << i << setw(10) << static_cast<char>(i) … | |
Re: The key part of the assignment was make a function. You have thrown all of your code into main(). Make it a separate function that you can call in main(). Double check your formula for A with a calculator. Also, you did not use the M_PI constant, you wrote your … | |
Re: Congratulations on (re)discovering the Cantor set. Can you supply a formal proof? | |
Re: Hint: use the method [URL="http://msdn.microsoft.com/en-us/library/system.string.isnullorempty.aspx"]String.IsNullOrEmpty()[/URL] You may want to change around your for loop into a while or do/while loop. You could use either of those structures to make sure you have at least 1 item in each and keep re-prompting if you don't. | |
Re: [QUOTE=Banfa;1195916]You can not compare fractions unless they have the same denominator. If they have the same denominator then you can simply compare the numerators.[/QUOTE] If they don't have the same denominator you can multiply denominator of the 2nd by numerator of the 1st and then denominator of the 1st by … | |
Re: Don't start a new thread I just replied to your other one... n doesn't exist in your class, you need the number value, see next sentence. Make a getter method for your card class that returns the value. Make a second method that returns the suit if there is a … | |
Re: Try something like this: [code] string concat=""; foreach (Control ct in Controls) if (ct is TextBox) concat = (ct as TextBox).Text + "\r\n"+concat; //this puts a CRLF in between each YMMV [/code] (It seems that the foreach is iterating through the controls backwards -- I double checked that they were … | |
Re: [QUOTE=Software guy;1197029]I think this program is really easy, I tell you why: When the user inputs the data forexample hours , minutes and seconds. It is possible to convert that into angles. On calculators there is special button to do that as well. You can check this link below and … | |
Re: Add the directory that the lib is in under Project, Properties, Configuration Properties, Linker, Additional Library Directories and add the name of the lib into Project, Properties, Configuration Properties, Linker, Input, Additional Dependencies. When debugging you may have to set the Project, Properties, Configuration Properties, Debugging, Working Directory to the … | |
Re: On line 31 you are trying to pass "cout" instead of "count" to your method. | |
Re: Have you named your executable the same name as some other system software? It doesn't seem like your code has any error message like that. Try renaming your program. | |
Re: Do you have the AcceptsTab property of the textbox set to true? I was able to get it using [code] private: System::Void textBox1_KeyDown(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e) { if(e->KeyCode == Keys::Tab) MessageBox::Show("Tabbed!"); } [/code] | |
Re: So the healthy eating ethic and the non-spamming ethic don't overlap? | |
Re: See [URL="http://www.daniweb.com/forums/thread268865.html"]this recent thread of cwarn23[/URL]. It's got an administrator response on there from Happygeek. ![]() | |
![]() | Re: IMO, you could have a system where posts on threads over 3 months old require moderator permission. It's more work in the short term but having to take the time to approve 5 threads rather than having to close 20 for the usual spam,"I have a totally unrelated problem but … ![]() |
Re: [QUOTE=kodera;1196102]This is just the beginning of my name sort prog... I am starting with just reading in the names and then outputting each name... As of right now, it is crashing after displaying the first name... I think it's something with my array.. rectangular, instead of square, but don't know … | |
Re: Line 22 should be [icode] rad = input*pi/180; [/icode] (since pi rad = 180 degrees) (also cos(2*pi) = 1 not 2) I didn't check your series approximation but see if that fixes it first. | |
Re: You can concatenate the variables right onto a string: [code] double pi = 3.14159; int i = 3; MessageBox::Show(pi+" rounded down to the nearest integer is "+i);[/code] If the object is not of one of the fundamental datatypes (int, double, etc) you will need to call it's ToString() method. The … | |
Re: Look at line 94: [icode]for ( ndeps=0; fin >> buffer && buffer[0] != '-'; ndeps++); [/icode] There's one thing that's missing there and one thing that's extra. You need to declare ndeps as an int (since the other ndeps in the program is unrelated making the global variable is definitely … | |
Re: You ought to be able to use a picturebox, the contents of which you can probably get as a stream from the web, go from a stream to an image. Were you planning on writing the text onto the banner directly? If so you could have a label that you … | |
Re: Ok, I didn't regret clicking on that nearly as much as I thought I was going to. Save up, buy the real stuff, nuff said. | |
![]() | Re: [QUOTE=ddanbe;1193265]Change your constructor private Dictionary<char, int> alphabetList = new Dictionary<char,int>(); into private Dictionary<int, char> alphabetList = new Dictionary<int,char>(); Because a Dictionary constructor first has a Key type and then a value type. [/quote] I think the OP wants it like he has it because he wants to keep counts of … |
The End.