1,362 Posted Topics

Member Avatar for sneekula

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.

Member Avatar for Ene Uran
0
1K
Member Avatar for gwenky

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.

Member Avatar for vmanes
0
90
Member Avatar for grisha83

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] …

Member Avatar for vmanes
0
96
Member Avatar for xenocide001

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 …

Member Avatar for vmanes
0
129
Member Avatar for The Dude

That one looks too much like a dentist's chair. [URL="http://www.poetictech.com/aura/index.html"]How about this one?[/URL]

Member Avatar for GrimJack
0
141
Member Avatar for The Dude

6 as well. But then I'm a Yank who's only spent relatively small amount of time in the UK.

Member Avatar for steven woodman
0
264
Member Avatar for Lardmeister

[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.

Member Avatar for sneekula
0
765
Member Avatar for DevC++4.9.9.2

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 …

Member Avatar for vmanes
0
129
Member Avatar for afg_91320

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. …

Member Avatar for Alex Edwards
0
556
Member Avatar for freudian_slip

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 …

Member Avatar for vmanes
0
149
Member Avatar for college.student

[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 …

Member Avatar for vmanes
0
101
Member Avatar for cam875

[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 …

Member Avatar for ddanbe
0
163
Member Avatar for DragonReborn225

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 …

Member Avatar for vmanes
0
182
Member Avatar for freudian_slip

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]

Member Avatar for Prabakar
0
10K
Member Avatar for kyserthehun

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.

Member Avatar for ddanbe
0
787
Member Avatar for ZZucker

When will someone create an operating system called "Doors"? And will it have back windows for malware to exploit?

Member Avatar for Lardmeister
0
1K
Member Avatar for clutchkiller

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( ).

Member Avatar for sidatra79
0
78
Member Avatar for theories

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]

Member Avatar for theories
0
126
Member Avatar for StainlessSteelR

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 …

Member Avatar for ndeniche
0
225
Member Avatar for traza786

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 …

Member Avatar for traza786
0
213
Member Avatar for shrek502

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.

Member Avatar for platinum8
0
220
Member Avatar for Gagless

[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:

Member Avatar for Freaky_Chris
0
305
Member Avatar for nirav0190

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?

Member Avatar for vmanes
0
92
Member Avatar for itdupuis

[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.

Member Avatar for itdupuis
0
486
Member Avatar for thinfineline
Member Avatar for chococrack
0
116
Member Avatar for vmanes

(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 …

Member Avatar for sneekula
1
208
Member Avatar for grisha83

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 …

Member Avatar for grisha83
0
99
Member Avatar for afg_91320

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]

Member Avatar for dumparun
0
169
Member Avatar for vmanes

The [URL="http://www.flixxy.com/sumsing-turbo-3000-cellphone.htm"]Sumsing Turbo 3000 XL cellphone[/URL]

Member Avatar for ahamed101
3
94
Member Avatar for Se7Olutionyg

[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 …

Member Avatar for Se7Olutionyg
0
116
Member Avatar for koman

[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 …

Member Avatar for Salem
1
111
Member Avatar for afg_91320

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 …

Member Avatar for kenji
0
348
Member Avatar for Se7Olutionyg

Read the error message - what does it say? Also, please use code tags. (Hing - check your spelling, capitalization counts.)

Member Avatar for skatamatic
0
91
Member Avatar for Lardmeister

A penny save is...... .....not gonna get you very far, unless it's got lots of friends.

Member Avatar for sneekula
0
366
Member Avatar for Benbon86

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.

Member Avatar for Benbon86
0
688
Member Avatar for nizbit

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?

Member Avatar for Insomniac119
0
161
Member Avatar for preet4fun

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]

Member Avatar for Salem
0
207
Member Avatar for unk45

See [URL="http://www.daniweb.com/forums/thread147897.html"]recent thread[/URL] that dealt with similar issue.

Member Avatar for unk45
0
275
Member Avatar for cw1184

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 …

Member Avatar for cw1184
0
209
Member Avatar for VernonDozier

[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.

Member Avatar for VernonDozier
1
162
Member Avatar for Bigboy06

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 …

Member Avatar for Salem
0
144
Member Avatar for vrga

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; …

Member Avatar for vrga
0
115
Member Avatar for Royalwolf

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 …

Member Avatar for Royalwolf
0
3K
Member Avatar for clive2008

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 …

Member Avatar for ArkM
0
74
Member Avatar for kenji

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] == ' ' …

Member Avatar for kenji
0
9K
Member Avatar for osirus0830

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 …

Member Avatar for arinkverma
0
94
Member Avatar for bodomchild

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 …

Member Avatar for bodomchild
0
140
Member Avatar for ART01

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?

Member Avatar for ART01
0
108
Member Avatar for vmanes

[URL="http://blog.wired.com/gadgets/2008/09/impulse-buyers.html"]Microsoft, Cray Unleash $25K Mainstream Supercomputer[/URL]

Member Avatar for R0bb0b
0
168
Member Avatar for The Dude

So you're bumping your own old thread? I'm Üreenmywai Walters So gettoutamaweigh now!

Member Avatar for sneekula
0
179

The End.