1,362 Posted Topics

Member Avatar for robert.speciale

If your point is to ignore duplicate IDs, perhaps you need to keep a list in the function of all IDs that have been read and search that first. If it's the first time an ID has been read, then call the find function, otherwise skip the entry.

Member Avatar for robert.speciale
0
239
Member Avatar for maHvic

If you're looking to create a sequence of ones and zeros, you need to do some division and modulus operations. Look [URL="http://www.purplemath.com/modules/numbbase.htm"]here [/URL]for some example of the process. You can do a 'net search and find many more examples.

Member Avatar for AndrisP
0
1K
Member Avatar for joeydal

It would help if you would ask a specific question. What happens when you try to run your program? Where do you think the problem lies? Just few quick observations: line 24 ought to also include a test that count has not exceeded the array size line 27 ought to …

Member Avatar for tinstaafl
0
190
Member Avatar for beginner at c++

That's a nice problem. When you show your work and ask specific questions, we'll be glad to help.

Member Avatar for Labdabeta
0
269
Member Avatar for little_engine

Big problem, you haven't provided an implementation for `void input(ifstream& input,int studentid);`

Member Avatar for little_engine
0
364
Member Avatar for nick.rechtien.5
Member Avatar for NathanOliver
0
150
Member Avatar for wschamps42

Without seeing the rest of the code, it's hard to find your problem. Is the array actually filled with valid data? What you show appears to be all integer arithmetic, so how does a floating point value come about?

Member Avatar for vmanes
0
248
Member Avatar for tanmay.majumdar2

Also, the way you're using eof( ) can lead to incorrect results. When you first test it, before attempting to read from the filestream, eof( ) has no real meanning. It's not until you attemtp to read past the end of the file that eof( ) will true. If the …

Member Avatar for vmanes
0
142
Member Avatar for tomz6

The CPU has only a tiny bit of memory, the registers. You might also consider the L1 and L2 caches to be CPU memory, but those are controlled by the cache controller logic, you don't get any direct access unless you go mucking about in kernel code. If you mean …

Member Avatar for rubberman
0
242
Member Avatar for gelmi

Hard to help when the program works. The interface is a bit awkward in places, but it functioned for me. I entered month, number of days, then start and end time. It did some calculations and displayed the worker's info. Did this for two workers, it found both. Some indentation …

Member Avatar for rubberman
0
167
Member Avatar for $Tweety$

I was going to suggest one that translates internetspeak into proper English, but I think pyTony pretty much has that topic covered.

Member Avatar for vmanes
0
260
Member Avatar for tformed
Member Avatar for craig.durnin.1

You need to wrap the body of your code (lines 10-33) inside a loop. When the result is displayed, ask the user if they want to find another, get at yes/no type response, check it.

Member Avatar for craig.durnin.1
0
7K
Member Avatar for xNeverLetGo

All your processing of the input value needs to be inside that first for loop. When categorizing the numbers, all you need do is test for > 0, then use an else to handle everything else that must be 0 or less. Where you add the positives and the negatives, …

Member Avatar for xNeverLetGo
0
1K
Member Avatar for Kareem Klas

And for whatever reason, 0 is traditionally the value a program returns upon normal completion. You can return other values and for the purposes of your program define what they mean, perhaps indicating various error conditions that caused the program to not complete normally.

Member Avatar for PrimePackster
0
1K
Member Avatar for The Dude

Father Norton woke up Sunday morning and realizing it was an exceptionally beautiful and sunny early spring day, decided he just had to play golf. So... he told the Associate Pastor that he was feeling sick and persuaded him to say Mass for him that day. As soon as the …

Member Avatar for Ene Uran
9
4K
Member Avatar for meetjatin88

Also, if accessing data in a large 2D array, you should generally order the looping so that you work across rows, not down columns.

Member Avatar for mike_2000_17
0
192
Member Avatar for ryan.maure

In line 180 you set `head` to NULL Then in line 183 you set `temp1` to be `head` In line 186 you are making a comparison to the `temp1` which is, NULL pointer

Member Avatar for ryan.maure
0
295
Member Avatar for wids101

Are you sure you put the precision statement before any output occurs? If you mark the thread solved, it would be helpful if you tell all how you solved it. This may aid others later on.

Member Avatar for vmanes
0
99
Member Avatar for MRehanQadri

Close but not quite. What sort of structure are you intending to create? If it's a two dimensional array, you first allocate the pointers to the rows, then allocate the rows, like: int main(){ td p; int i; p.subj_no = new int * [7]; for( i = 0; i < …

Member Avatar for vmanes
0
176
Member Avatar for miles.sifflet

A great many of the errors you now see are easily corrected. Go to the indicated lines and you'll find you placed semicolons in the middle of chained outputs or made other typos. Read the error messages and do the corrections. Let us know if you have further problems. The …

Member Avatar for miles.sifflet
0
410
Member Avatar for chandnigandhi

Yes, MS has a speech functionality that can accessed even in command line programs. Look at the sapi.h library.

Member Avatar for nova37
0
217
Member Avatar for sarah.mathieson.7
Member Avatar for ConfusedLearner

For this small program, I would make the input operation a function. You'll have to pass the x and y variables by reference is you want a single function call to get both. Or you could have an input function that just gets one value and returns it.

Member Avatar for vmanes
0
96
Member Avatar for lewashby

Concerning the first question, or what I take the first question to be, how does the statement `while(szTarget[targetIndex])` work, or what is it doing. That's actually a pretty common technique to use when writing your own functions to manipulate c-style strings (array based, null terminated). The loop keeps examining/processing characters …

Member Avatar for vmanes
0
77
Member Avatar for kenney.d.lewis

Moschops - how do you know the GetCoefficients method isn't using reference paramters? Yes, it apparent the OP does have some confusion on this issue, as the function above has the x and y passed by reference but attempts to return both of them. `return x,y; ` will only return …

Member Avatar for Moschops
0
259
Member Avatar for rikkie

31.6, 44.7, both wrong. Rikkie, your code, once corrected, gives the correct response of 22.36, which is 1/2 what you show above. What did you do? One other point: For C++, the math library is <cmath>, not <math.h>

Member Avatar for phorce
0
2K
Member Avatar for SANTHOSHEINSTEIN

I would first ask - Why? It's 10 years old, or more, not meant for modern systems such as Win8. There are plenty of other no-cost options available.

Member Avatar for vmanes
0
57
Member Avatar for ndeniche
Member Avatar for lewashby

Further, The array of strings (argv) is (essentially) created by the operating system at the time the program is invoked. The argc value is how many space delimited items were on the command line (including the program name) and thus how many valid strings are in the argv array. You …

Member Avatar for Lerner
0
128
Member Avatar for <M/>

Regardless of whether the chicken or the egg came first, why did either of them cross the road?

Member Avatar for <M/>
0
389
Member Avatar for <M/>

Colossus, from the Forbin Project. It's the progenitor of SkyNet. Or today's Democrats. I'm not sure which.

Member Avatar for <M/>
0
214
Member Avatar for <M/>

The old Pepsi ad with the kid covered in puppies. https://www.youtube.com/watch?v=YTOWMsm6W6w

Member Avatar for <M/>
0
185
Member Avatar for xxwikkixx

You could still keep the seeding from reoccurring like: static bool seeded = false; if( !seeded ) { srand( unsigned ( time( NULL ) ) ); seeded = true; }

Member Avatar for vijayan121
0
198
Member Avatar for new_developer

Do your deposit functions take a value directly into a numeric variable, like: cin >> dep_amount; If so, then there's a newline left on the input stream that halts your getline without any new input to the loop variable.

Member Avatar for deceptikon
0
1K
Member Avatar for ahpple.gonzales
Member Avatar for marnun

For starters, I would turn your testing into a series of if..else if statements, including the final recusive call. Then you need and else case that returns false.

Member Avatar for marnun
0
516
Member Avatar for putri MSR

In just the bubble sort I see several typos. Don't have your sort functions call the display function - do that back in main. Please, please use some horizontal and vertical spacing and indenting

Member Avatar for vmanes
0
504
Member Avatar for jason.louis.798

If you're referring to the Beep function in windows.h, the quality of the sound system and speakers can make a difference between computers. Lower frequencies may not work well, and just where you lose the high frequencies will also be very system dependent.

Member Avatar for deceptikon
0
90
Member Avatar for thePAkid

Want to give us a hint as to what problems you are encountering? Which functions work, which ones don't?

Member Avatar for vmanes
0
244
Member Avatar for pjh-10

Of course, on any given system (OS + compiler) on which you work, you can check the size of each data type with the sizeof( ) operator. cout << sizeof( int ); //repeat for each type you're interested in. The sizes that were given above are quite common. You'll most …

Member Avatar for vmanes
0
228
Member Avatar for ao_py

One problem is that you wait too long to start checking for a winner. After the players make their fourth move, a win is possible. So your test should be if( i >= 3 ) //four moves have been made. Also, your last two tests are the same, checking the …

Member Avatar for luzan
1
804
Member Avatar for kruschev

You will have trouble when you enter anything outside the range of the target variable's type. It's usually wise to use a type that holds more range or precision that what you expect input to be, if you don't have strict control of the input. Is there a particular reason …

Member Avatar for nullptr
0
279
Member Avatar for thePAkid

Nothing shows up because there is nothing in the program above that either displays on the console or writes to file. Uncomment the call to the average function. Your reading function is missing the actual reading. In the loop, you access the array elements, but don't do an input to …

Member Avatar for vmanes
0
148
Member Avatar for tomz6
Member Avatar for ayieye

You don't actually present the problem to the student - are they supposed to telepathically know what values are returned to x and y? I would only call srand( ) once, in main( ). The way you are using it, I would expect the same to "random" values to be …

Member Avatar for ninidesobra
1
189
Member Avatar for aqWed_ton

I don't think dos.h will do anything for you related to time. Try the <ctime> library.

Member Avatar for vmanes
0
78
Member Avatar for marnun

First, define "efficient". I can think of solutions that are efficient in terms of speed, and in terms of memory usage. As to solving the probem, yes, an array will almost certainly be needed for any solution. It's a matter of what you put in the array, and what you …

Member Avatar for marnun
0
267
Member Avatar for kimika

`while (bookTitle[] == 0)` You need to specify an index, which book title are you comparing to? The comparison should be to an empty string, represented by "" (two double quotes, no space between them.) And in the rest of the function, you also need to specify array indexes.

Member Avatar for kimika
0
243
Member Avatar for wids101

I don't know about freezing, but it looks like it will be waiting for you to enter another number, regardless of whether the user enters one in the valid range or not. You need a set of { } around the two statements following the `if( num >= 20 )` …

Member Avatar for tinstaafl
0
99

The End.