1,362 Posted Topics
Re: On television today a Democratic operative pointed out that when Obama holds a rally 25-30,000 people show up, whereas when McCain holds one he only draws 10-15,000. The Republican spokesman replied, That's because McCain's supporters are at work. | |
Re: Within the display( ) method for your class, simply do the output of the object's real and imag data members, with whatever formatting you want to see. | |
Re: It really helps if you tell us what the error message is, or at least when/where it occurs (complier, linker, runtime?). Even if you don't understand the message, it probably points you to where the problem exists, in this case, it's this line [code] positionSpace = string_in.find (' '); [/code] … | |
Re: Three things. 1 - your use of get( ) is reading your data file as integers, not char. You need to use the form of get( ) with the destination variable as a parameter, like [icode] arch2.get( par);[/icode] 2 - your positioning of the file pointer is off in nowhere … | |
Re: That one looks too much like a dentist's chair. [URL="http://www.poetictech.com/aura/index.html"]How about this one?[/URL] | |
Re: 6 as well. But then I'm a Yank who's only spent relatively small amount of time in the UK. | |
Re: [QUOTE=Lardmeister;719012]Oh Jesus! Next thing you tell me is that there is no Santa Claus or Easter Bunny![/QUOTE] Yep, they're not real. The Tooth Fairy told me so. | |
Re: Your getData( ) function is being passed the int ** BY VALUE. It can allocate memory to that pointer variable, but that allocation only exists within the scope of the function. The int ** in main( ) is still not allocated any memory. So, to make life interesting, you must … | |
Re: You cannot assign (the contents of) one array to another with a simple assignment statement. You have to write code that assigns from array2 to array1 element by element. In your function, the parameter must give the column dimension (second set of [ ] ), the row dimension doesn't matter. … | |
Re: sqrt() takes only floating point values as its argument, so I'm curious what compiler you're using that accepts the ints. That said, the division 2/num (I'm assuming num is assigned value 8) results in value 0 (zero) being passed to sqrt( ). Remember, the result of dividing one int by … | |
Re: [QUOTE=Ancient Dragon;726364] If you don't want to use precompiled headers then go to Project --> Project --> C++ tab --> Precompiled Headers and turn them off. (Assuming VC++ 2005/2008 compiler)[/QUOTE] And when creating a new project, be sure you're selecting a Win32 Console application, and on the Application Wizard you … | |
Re: [QUOTE=cam875;725077]so your saying that if you have data as globals another separate program is allowed to manipulate that data easier? I thought it didnt matter where it was in RAM?[/QUOTE] No, that's not what's being said. Programs are in separate memory chunks. Only if you take special actions to allocate … | |
Re: What's the purpose of [icode]pal[index] = 30; [/icode]? You're changing the first character, thus making a test always fail? Two things missing from your logic: - The initial test of length == 0 only works on first call. Subsequent recursive calls must compare your shortened "word" length, which really should … | |
Re: You probably should update your usage of the libraries to look like: [code] #include <cstdio> #include <cmath> #include <iostream> #include <cstdlib> using namespace std; [/code] | |
Re: In this [URL="http://en.wikipedia.org/wiki/Zeller_congruence#Implementation_in_software"]wiki article[/URL], it notes that to handle the way modulus operator works in software, your last term should be be +5*c rather than -2*c. Seems to work for me. | |
Re: When will someone create an operating system called "Doors"? And will it have back windows for malware to exploit? | |
Re: Find the length of the text. Subtract that from the width of the output line (usually 80 in a console window). Output half that number blanks before outputting the text, or use setw( ). | |
Re: You could take the abs( ) of the generated number. Or how about: [code] unsigned int num; num = rand( ); num = num << 16 ; num += rand( ); num %= 100000; [/code] | |
Re: 1) You ask for the name in main( ), and again in the showRByards( ) function. Pick one. 2) [code] void det_max(int yards,int max) { if (yards >= max) max = yards; } [/code] How is the new max supposed to be communicated back to the caller? Review your notes … | |
Re: The only place that I can see where array parent might get written to outside its range is this bit in function spr() [code] for(v=0;v<num_node;v++) { if(distance[u] + netcost(u,v) < distance[v]) { //printf("u %d, v %d\n", u, v); distance[v] = distance[u] + netcost(u,v); parent[v] = u; [/code] Is there any … | |
Re: Define "crashed" and define "lost all my data". Buzzer's advice to retrieve the data using the drive connected to another PC is good. Even better if you can connect it in a way that disables writing to the affected drive. | |
Re: [QUOTE=Gagless;719970]Okay so I'm doing 90 + 65 - Input[/QUOTE] Now, to make it more portable, and to eliminate the "magic numbers" do the arithmetic using the actual characters. Clever little problem. I like it. I may torture my own students with this sometime. :twisted: | |
Re: Now go back to your notes from the first few weeks of class. I see at least 13 syntactic mistakes in the code above, not counting mistakes that are repeated. Not to mention that you're not doing anything that seems to work towards solving your problem. Are you really trying? | |
Re: [QUOTE=sharkymo;700345]ya man they do scare the people..but anyway test-1 is over...so no worries...[/QUOTE] Ah, but they haven't cranked it all the way up yet. | |
Re: You're doing input of num twice in the loop, but only adding it once. | |
(this is an oldie, but I don't see that it's been posted here on DaniWeb) 1. Defensive programming? Never! Klingon programs are always on the offense. Yes, offensive programming is what we do best. 2. Specifications are for the weak and timid! 3. This machine is GAGH! I need Quad … | |
Re: This belongs in the C++ forum, not Geeks lounge. That said, what error do you get? You should read and heed error messages. Even if you don't fully understand what it's saying, it should point you to the neighborhood of the problem. You call do_next_op( ) before you've gottne any … | |
Re: I usually approach this kind of a problem like: [code] do { menu_func( ) //which may also get the choice and return it switch( user_choice ) { //do the work here } }while (user_choice != quit_value ); [/code] | |
The [URL="http://www.flixxy.com/sumsing-turbo-3000-cellphone.htm"]Sumsing Turbo 3000 XL cellphone[/URL] | |
Re: [code] else if ( (15000 < income) && (income <= 44000)) [/code] is more than you need to write. The use of if...else if... will preclude having to retest for the preceding conditions, so you can simplify the code like [code] if (income <= 15000) { //do something } else … | |
Re: [code] for ( int i = 1; i <= num; i++ ) { if ( i % 2 != 0 ) ( i = q , u ); [/code] Your loop should update by adding two, thus you will test sequence 1 3 5.... and won't need the test for … | |
Re: Get out a piece of paper and a pencil. Sketch out how you think the program should be broken up - you can use flowchart, psuedocode, whatever helps you organize your thoughts. What are the main aspects? If you tried to write this as one massive main( ) function, what … | |
Re: Read the error message - what does it say? Also, please use code tags. (Hing - check your spelling, capitalization counts.) | |
Re: A penny save is...... .....not gonna get you very far, unless it's got lots of friends. | |
Re: If you read the sticky posts in this forum, you'll see we don't do your work for you. Please show the work you've done so far, and then we'll help point you in the right direction. | |
Re: That's an awful lot to expect someone to look at, and get you a response in your timeframe. Does the seg fault message give you any indication of where the problem lies? What have you done to track it down? | |
Re: If you're taking the input phrase into a string (char array based or string type) simply access the individual characters as array elements. [code] string s; cin >> s; for( int i = 0; i < whatever; i++) cout << s[i]; [/code] | |
Re: See [URL="http://www.daniweb.com/forums/thread147897.html"]recent thread[/URL] that dealt with similar issue. | |
Re: First, drop the ".h" from <iomanip> As written, your code will show two decimal places for the Fahrenheit output (which had no value at this point), but will use C++'s default display for your redisplay of the Celsius. Put the two formatting statements before any output. To see only one … | |
Re: [QUOTE=Ancient Dragon;701228]>>Number 7 has two correct answers No -- 5.9875e17 can only be stored in a double -- floats are too small.[/QUOTE] My understanding is the range of a float is +/- 3.4e+/-38, with 7 digits precision. The number above would comfortably fit in that range. | |
Re: I think the problem is that your input method is then calling a constructor, which sets the month variable of a new, unallocated instance of Month. The instance m1 in main( ) does not get modified. You can see this if you step through the program, watching the value month … | |
Re: Just how big are your matrices supposed to be? What is the input data. From your code, I see two sizes: [code] for (i =0; i<9; i++) { in >> num1 >> num2 >> num3; { RowA.push_back(num1); RowA.push_back(num2); RowA.push_back(num3); MatrixA.push_back(RowA); RowA.clear(); } } for(int i=0; i<3; i++) { for(int j=0; … | |
Re: Consider testing the current value of col and row, only display the * if row is top or bottom, or if col is left or right edge. You also should consider getting in the habit of processing in a row oriented fashion. It may not make any difference in this … | |
Re: AD's solution is a good one. I'd just like to explain what I see going wrong with the original code. First off, eof( ) should never be used until something's been attempted to read - it's meaningless on first testing, and will sometimes cause last item read to be processed … | |
Re: How about this, based on the idea of the bubble sort? [code] void compact( char arr[], int size ) { int i, j; for( i = 1; i < size; i++ ) { for( j = 1; j < size - i; j++ ) { if( arr[j-1] == ' ' … | |
Re: This is a counting problem, which usually leads one to use a for loop. Really, what will cause the loop to end is a condition unrelated to the counting, per se. You need to be comparing each woman's total balance, after the interest has been added. Also, the problem statement … | |
Re: That seems a pretty advanced project for just two weeks into a course. You'll find you won't get much in the way of specific help here till you show you've attempted to solve the problem yourself - show the work you've done, ask questions about problems you encounter. Your samples … | |
Re: You meant to say: [code] void update ( int a*, int size, int len, int x, int y ) //or void update ( int a[], int size, int len, int x, int y ) [/code] right? | |
[URL="http://blog.wired.com/gadgets/2008/09/impulse-buyers.html"]Microsoft, Cray Unleash $25K Mainstream Supercomputer[/URL] | |
Re: So you're bumping your own old thread? I'm Üreenmywai Walters So gettoutamaweigh now! |
The End.