1,362 Posted Topics

Member Avatar for Moporho

You don't need a for loop to display the single value user wants. Simply test if the input value i is between 0 and size-1, inclusive. If so, display the array element at that index. You should wrap all this in a loop that continues as long as the input …

Member Avatar for Moporho
0
153
Member Avatar for The Dude

14 right. I was halfway expecting the solution to be all Falwell/Robertson. Scary people on both sides.

Member Avatar for Drezta
0
60
Member Avatar for hsma

[quote]my problem right now is i cant get to calculate m correctly. heres the code i wrote so far. i know my code is cluttered and could be cleaned up but right now i just want the program to work.[/quote] Please explain how m is to be computed. It looks …

Member Avatar for vmanes
0
125
Member Avatar for steven woodman

Cool? yes. Technologically interesting and challenging? yes. Does it do a darn thing to make a computer more useful? Hardly. Most of that demo shows effects that are eye candy and fluff, but do nothing for usability - they are big time and resource wasters. Do you really want to …

Member Avatar for jbennet
0
158
Member Avatar for Drezta

Don't put data types with your arguments, where you are calling the functions. Just the argument variables. For that matter, why are you passing parameter [icode]input[/icode] to the functions, if the input action is done in them? As you have them structured, all your functions need is the conversion rate.

Member Avatar for Drezta
0
196
Member Avatar for >shadow<

Sounds like GBR is getting really wimpy on what they'll let in. Many years ago a club DJ friend spent over a week continually playing records - the bar was "open" 24 hours a day during this feat (only served non-alcoholic stuff during non-legal hours), logs were kept of witnesses, …

Member Avatar for >shadow<
0
110
Member Avatar for rikkie

You need some additional condition to know when you've replaced an 'o', and make the loops quit. If this action is the sole content of a function, this might be one good case to just return immediately upon doing the change.

Member Avatar for vmanes
-1
151
Member Avatar for BBustos

[QUOTE=ivailosp;583446]forced to use only one return in a function- lol that's new for me :][/QUOTE] Come to my class sometime! I teach that generally, the loop condition controls when the loop ends, exiting prematurely should be for exceptions. As AD said, one way into the function, one way out - …

Member Avatar for vmanes
0
127
Member Avatar for complexcodes

If you want your output operator to output the data in rows and columns, you'll need nested looping to do that, or at means of knowing when you've output "column" number of elements, then output and endline, and reset that counter, if needed. I don't anything in the input overload …

Member Avatar for vmanes
0
118
Member Avatar for vegaseat

[QUOTE=jwenting;557229] For those of you with bad eyes :) here's a bigger view of the aircraft I showed earlier that noone has yet identified: [url]http://hornet.demon.nl/Dscn1451.html[/url] Double points if you know what the aircraft with tail number "46" is that you can only see the tail and exhaust of (tip, you …

Member Avatar for jwenting
1
1K
Member Avatar for kalodakilla

The problem, while exhibiting itself when the destructor is called, is not actually in the destructor. Your Copy function makes a shallow copy - in your code object "a" points to the same memory as object "integer". When the first of those gets destroyed at program exit, the pointed to …

Member Avatar for kalodakilla
0
326
Member Avatar for Exo1337

You know how to pass the value to be tested to you function, right? And how to return true or false? So your middle part is how to determine if the tested value is a vowel. The vowels are a,e,i,o,u (and sometimes y). Compare to those characters (probably both the …

Member Avatar for vmanes
0
209
Member Avatar for complexcodes

For starters, your private members should include the row and column sizes. Thus, your overloaded ( ) operator would compute the actual index, using something similar to what you commented out in your constructor above [icode] index = desired_row * columns + desired_column;[/icode]

Member Avatar for vmanes
0
534
Member Avatar for darkrappaz

First, please spend a bit of money on some indenting, it's cheap. Simple solution is to allocate single record object. Input to it, then assign it to the next spot in the array. [code=c++] //after line 21 record temp; //replace line 42 & 44 cin >> temp.name; cin >> temp.number; …

Member Avatar for vmanes
0
91
Member Avatar for josh2

[QUOTE=jwenting;582028]On the first pull of the trigger, there's indeed a 50% chance. There's either a bullet there or there's not. Of course depending on the gun the chance of getting shot might be 100% as some guns have a mechanism that skips empty chambers :) On the second pull, there's …

Member Avatar for scru
0
187
Member Avatar for cobberas

The pointer is not needed. Perhaps this code is simply a means to demonstrate how you might access the data either via its array element or a pointer to an element. For example, lines 21-23 might also be written as: [code] strcpy( Candies[0].brand , "Mocha Munch" ); //see below Candies[0].weight …

Member Avatar for vmanes
0
238
Member Avatar for sisi

If your problem is to display the number of votes each candidate got, you'll use a loop similar to your input loop, only output each element of the candidate array. If you want to only show which candidate won (got the most votes), you'll have to go through the candidate …

Member Avatar for vmanes
0
128
Member Avatar for CNSK207

[QUOTE=ivailosp;580914]double fntArray[count]; work in gcc[/QUOTE] Yes, because the gcc people are getting ahead of themselves. That usage has been adopted for C, but has yet to be actually incorporated in the C++ standard, as I understand it all. So such use is not going to be portable for some time …

Member Avatar for vmanes
0
117
Member Avatar for Black Magic

What is this [b]really[/b] doing? [icode] for (loop = 0; loop > 5; loop++)[/icode]

Member Avatar for Black Magic
0
86
Member Avatar for skatamatic
Re: Pi !

Type float has less precision than double ( 7 digits versus 15). There is a long double type, but it varies among compilers/operating systems as to how much more precision you'll get ( no more at all on Visual C++, typically it's a 10 or 12 byte value on others. …

Member Avatar for skatamatic
0
147
Member Avatar for digital_ice7

Because your account file variable (used in the open function) is not a valid string?

Member Avatar for Nick Evan
0
107
Member Avatar for Suraine

To get random values in some range, use the modulus operator as a means to limit the final value.

Member Avatar for vmanes
0
84
Member Avatar for Yellowdog428

In main( ), you have a value lowest and a pointer to it, lowptr. Your function dropLowest( ) takes a parameter by value, to which you store the lowest found value, and return that. Back in main( ), you do not capture that returned value, so it's lost (the dropped …

Member Avatar for Yellowdog428
0
98
Member Avatar for UnnamedPlayer

First, your function names seem backwards - typically input means reading from file, output is to write to the file. That said, to attack your problem you need your file reading function to store to an array of your struct type. Once stored, in a search function you ask the …

Member Avatar for vmanes
0
94
Member Avatar for DJEEPER

What's wrong with this bit: [code] getValues(n,lg,dataok); while(!(dataok=false)) { [/code] Once you figure that out, you really need to go back and revisit your logic for the loop. The dataok variable looks to be doing two different jobs - somehow telling me the input values are ok to use, and …

Member Avatar for vmanes
0
215
Member Avatar for rt7878

[QUOTE=jwenting;570635]A car can be any colour as long as its blue...[/QUOTE] I believe Henry Ford said, "You can have your car in any color you want, as long as that color is black." My favorite car I've owned was a '69 Porche 911 (with a 1970 engine). All you had …

Member Avatar for sneekula
0
159
Member Avatar for TheBeast32

I can see several possible problem areas. First, you're reading in to type char, which is a signed type. What will it do with values over +127? Second, some of those values may be 0. When you do the assignment from the char array to the string, it only copies …

Member Avatar for TheBeast32
0
177
Member Avatar for majestic0110

[quote]6. Language and culture will forever be different and major advances in science and medicine will change how we view the world.[/quote] Hmm, hasn't that been happening since July 7, 1947?

Member Avatar for Anonymous86
0
102
Member Avatar for GPXtC02

Assuming you have a declaration for [icode]char * newptr;[/icode] your handling of the pointer arrays looks correct, as far as that goes. There are other problems or questions: First clarify, is the data in the form you show in example ( fn ln s1 s2 s3 s4) or as in …

Member Avatar for vmanes
0
492
Member Avatar for idle09
Member Avatar for vmanes
0
33
Member Avatar for ulrik04

In short, you probably want to detect the WM_KEYDOWN message from the spacebar, and until you see the WM_KEYUP from spacebar, process other key messages.

Member Avatar for ulrik04
0
77
Member Avatar for varsha0702

It's not a C++ issue, it's your operating system that doles out CPU time to the program. It sounds like yours is a pretty compute-intensive app, so it will take a lot of CPU time. Is your Linux/Windows disparity on the same machine (dual boot) or are you testing on …

Member Avatar for Salem
0
184
Member Avatar for guest7
Member Avatar for kruptof

[QUOTE=jwenting;573441]Godaddy is a large hosting company.[/QUOTE] More importanly, it's a domain registrar - one of the biggest these days. So big, they put an ad in the SuperBowl. And get a lot of notoriety for creating ads too scandalous to be aired (so they say, anyway).

Member Avatar for jwenting
0
97
Member Avatar for star289

Sit back an analyze what you're trying to do. It looks like your assignment is to count how many even numbers occur between num1 and num2. Is that count to also include num1 and/or num2 if they are even? num1 and num2 should be the starting and ending points of …

Member Avatar for star289
0
95
Member Avatar for infernojmd

You have functions that return values, yet you don't capture or use those in main( ). You are probably always computing the day that the random value in memory that G points to equates to. Garbage In, Garbage Out

Member Avatar for vmanes
0
97
Member Avatar for MONYE

Please read the "Read this before posting" at the top of this forum. Short version - have you looked for an answer? What have you written already? What does it do or not do? You'll get help here, when you've shown that you are actually trying to solve your problem …

Member Avatar for vmanes
0
38
Member Avatar for kartouss

Here's a little demo showing how t copy the string into the array. It does not account for string length, but simply demonstrates how you might start this process. [code] #include <iostream> #include <string> using namespace std; int main( ) { string text = "Encryption"; char b1[4][4]; size_t len = …

Member Avatar for vmanes
0
5K
Member Avatar for andyg55

You are missing counting the 1-0 combination. Your main matrix defiition does not agree with your comment about it: [code]int matrix[10000][5] = {0}; //Define a matrix with a maximum of 100 rows and 6 columns [/code] is really 10,000 rows by 5 columns. This is one of the problems with …

Member Avatar for Lerner
0
167
Member Avatar for Yaka

Are you in fact passing arguments to the program when you run it? It works ok for me, other than printing characters other than what's specified for the diamond's inner body and edge. Why all the use of pointers and address operators, when it looks like all function parameters should …

Member Avatar for ithelp
0
303
Member Avatar for dark7angelx07

And the number 1 thing wrong with it is that the test function returns TRUE for non-primes and FALSE for primes!!! Why the #define TRUE and FALSE when C++ has the perfectly good built in [icode]bool[/icode] type, with values [icode] true[/icode] and [icode]false[/icode]? ps - you're responding/reopening a three year …

Member Avatar for DavidB
0
1K
Member Avatar for DaveCachia

(AD, I'm hoping he means classmates) If your team members are not helping, I recommend a hardware approach - 3 foot 2x4 to their head or backside, whichever is softer.:twisted: I would get the data reading done, then the menu. Without data, it's hard to test the rest. From there, …

Member Avatar for vmanes
0
119
Member Avatar for sisi

In writing just one step of the formula, how can you relate the counter variable to what you see in the formula?

Member Avatar for Narue
0
125
Member Avatar for Waseemn

When you enter a name longer than the input allows, the cin.getline( ) sets an error condition, so no further input will be processed. If you expect to handle overly long input, you need to follow it with a [code]cin.clear( ); //resets error flags cin.ignore( nn, '\n' ); //set nn …

Member Avatar for vmanes
0
172
Member Avatar for robotnixon

I'm not clear on what the problem is. Your code is reporting the depth of recursion on the variable x. Do you really want a count of how many recursive calls are made? If so, create the counter variable in the function as static, increment at the entrance to the …

Member Avatar for robotnixon
0
93
Member Avatar for 666kennedy

If you mean you are using variable names in other functions, that's no problem. The names will be only visible within the function in which declared. Look up "scope" in relation to C++ variables.

Member Avatar for 666kennedy
0
255
Member Avatar for jimJohnson

You could approach this with a while loop, reading the name one time before the loop, then at the bottom of the loop [code] cout << "Programmed by Jim Johnson"; cout << endl << endl << "Type xxx for the name to Exit"; cout << endl << endl << "Enter …

Member Avatar for vmanes
0
251
Member Avatar for daviddoria
Member Avatar for vmanes
0
106
Member Avatar for agenthobbs

Could you expand on the problem statement a bit more? What do you mean by "structures similar to linked list" and the fact you store them in a multidimensional array? How many dimensions? If we're considering a 2D array, what does it mean to delete an element? I would think …

Member Avatar for VernonDozier
0
121
Member Avatar for resduq

You cannot print the whole array in one action. You cannot input a whole array in one action. There's really not much at all you can do with an array as a whole. You have to display it, element by element, in the same fashion as your input loop.

Member Avatar for resduq
0
281

The End.