1,362 Posted Topics

Member Avatar for pprabhat
Member Avatar for samson.dadson.3
0
115
Member Avatar for chubbyy.putto

Several comments, I hope you will be able to use them to improve your code. First, you say you are not to modify the input array, but you keep storing the largest found value at index 0 of the array. Better to allocate variables to store the largest value and …

Member Avatar for vmanes
0
206
Member Avatar for Charles_6

If I understand your question correctly, you want to modify the program to pass two values to the function, both to be modified, and get the two new values back in main? For that to happen, you're going to have to pass at least one of the two arguments by …

Member Avatar for ann.mughal.5
0
209
Member Avatar for chubbyy.putto

Look at the relationship of your line 7 and line 9. How does index relate to the bounds of the array? for (int index = 0 ; index < size2; index ++) if (sorting_array[index] > sorting_array[index + 1])

Member Avatar for chubbyy.putto
0
260
Member Avatar for mixelplik

You will also need to subtract 1 from the length to get the index of the last character.

Member Avatar for vmanes
0
138
Member Avatar for rat.man.9277
Re: C++

http://www.lmgtfy.com/?q=C%2B%2B+functions http://www.lmgtfy.com/?q=C%2B%2B+arrays http://www.lmgtfy.com/?q=C%2B%2B+arrays

Member Avatar for vmanes
0
58
Member Avatar for brandon66

I think the test in line 32 is unneccessary. If either X or O had won, you won't get to that test. If neither has won, then you should do the completed game test as the else action. Initialize the winner variable to the not complete value. When the if..else …

Member Avatar for brandon66
0
221
Member Avatar for rowen_1

Even char is not strictly defined as one byte, by my reading of the standard. > Objects declared as characters (char) shall be large enough to store any member of the implementation’s basic character set. Could there be an implementation that uses a larger character set?

Member Avatar for deceptikon
0
176
Member Avatar for 2concussions

In Visual C++ 2012, it works for me. In that environment, there's a compiler option to treat wchar_t as built in type. Project | Properties | Congifuration Properties | C/C++ | Language Yes (/Zc:wchar_t)

Member Avatar for rubberman
0
273
Member Avatar for phorce

I think it would help us to understand the problem if you showed what x[2] and [x3] should look like. From your sample, I don't see the pattern the problem is supposed to create.

Member Avatar for vmanes
0
188
Member Avatar for mixelplik

You marked this solved, but you're not really done. Line 64 in your search routine is not right. `if(array[lower] == num || array[ArraySize - 1] == num)` This tests the lower end index and the last value in the array (so what good is higher doing?) yet you then test …

Member Avatar for vmanes
0
214
Member Avatar for amirali870

We don't do your homework for you here. You write some of the program, test it, write some more, test it.... When you encounter a problem, post your code and ask a question. Point to the part of the code you think is the problem, describe what it should do …

Member Avatar for vmanes
0
239
Member Avatar for vmanes

(and oldie, but a goldie) * Defensive programming? Never! Klingon programs are always on the offense. Yes, offensive programming is what we do best. * Specifications are for the weak and timid! * This machine is GAGH! I need dual Pentium processors if I am to do battle with this …

Member Avatar for stultuske
3
257
Member Avatar for issamsaad
Re: help

Please read [this](https://sdsmt-ex13.sdsmt.edu/owa/auth/logon.aspx?replaceCurrent=1&url=https%3a%2f%2fsdsmt-ex13.sdsmt.edu%2fowa) first. We won't do your homework, we'll help when you encounter problems. Show some code, ask questions about it.

Member Avatar for issamsaad
0
113
Member Avatar for triumphost

For starters, I think you're off in setting the ptr `int** ptr = reinterpret_cast<int**>(&arr[0] + width * i)` If ptr is to point to the beginning of each "page" ( dimension specified by depth ) then you also need to multiply by height; `int** ptr = reinterpret_cast<int**>(&arr[0] + height * …

Member Avatar for Banfa
0
996
Member Avatar for kamalashraf

It would help if you put the whole context here, rather than relying on reading a couple of your other threads. That said, I think the big problem here is you're trying to input to a function. And a function that returns a value without taking any argument. Perhaps you …

Member Avatar for Moschops
0
140
Member Avatar for mixelplik
Member Avatar for mixelplik

You don't need the adress of operator (&) in your call to the 1D function. Just use the array name and index of the row. That is the address of, or pointer to, the row in question. ` calcNums(nums[1]);`

Member Avatar for mixelplik
0
695
Member Avatar for ddanbe

How full would your head get with a 1000 years of experiences? I have trouble remembering last Tuesday as it is. AD: Social Security in 900 years? You really are a comedian, aren't you?

Member Avatar for Ancient Dragon
2
2K
Member Avatar for ali hassan q
Member Avatar for raliot

Rather than set the lowest_found value to some abritrary high value, set it to the age of the first girl in the list. Then compare from the second one on. By setting the initial value to a valid data item, your code will be correct no matter what the range …

Member Avatar for Paul.Esson
0
140
Member Avatar for mixelplik

It will depend in part on what type of data the file represents. If it is a plain text file, AD's method will work. If the file contains numeric values, the size of the file won't tell you how many numbers are stored. Your method would suffice to find the …

Member Avatar for Ancient Dragon
0
366
Member Avatar for Jokatech

With processes spawning processes, this hardly sounds like a simple assignment. And the hint your prof gave really doesn't even touch the tough parts. Show some work, ask some questions, and we'll be glad to give some help. We won't do your work for you.

Member Avatar for richieking
0
296
Member Avatar for mixelplik

It would help to show a bit what the sample data file looks like. I'm betting you have numbers, which may be more than one digit? Your array is of type char, which holds one character per element. Perhaps you should change the array to type int? In your display …

Member Avatar for mixelplik
0
266
Member Avatar for RASHA_T

I don't see the user's guess actually being compared to anything. The test variable never gets set to anything, yet you use it to control the switch. Wait, do you mean the integer test that is global, or the Outcome test in main?

Member Avatar for RASHA_T
0
238
Member Avatar for HiHe

Not explaining why the thing has turned into such a huge blunder (getting back to the original topic of the website), but here's a perspective on the issue I found floating the interwebz > March 21st 2010 to October 1 2013 is 3 years, 6 months, 10 days. > > …

Member Avatar for mike_2000_17
1
858
Member Avatar for helb992

In your cal function, it looks like you only push single digits onto the stack, not the full value of any multidigit input. c=p2[i]; ..... default: { if(c>=48&&c<=57&&c!='c'&&c!='s') { Pushstack2(s,atoi(&c)); break; }

Member Avatar for vmanes
0
202
Member Avatar for petter.parker.37604

Using the input method `cin>>name;` you only get one word's worth of input. The extraction operator will stop when it encounters whitespace in the input stream (blank, tab, newline). In order to get your full name, you need to use the getline( ). Also, you need to declare your variable …

Member Avatar for vmanes
0
399
Member Avatar for cakka

eBay and PayPal have a reputation lately of siding with the buyer - much to the detriment of some sellers. They should make it right.

Member Avatar for jwenting
0
338
Member Avatar for pritaeas

Multiple DUI cases are quite common. In my area, there was a fellow with 11 DUI convictions, maybe upwards of 30 some arrests. He was known as Mr. DUI. Looke him up! He died in a house fire, presumed to have started from cigarettes. Smoking Wile Intoxicated? You can suspend …

Member Avatar for diafol
0
981
Member Avatar for Warrens80
Re: Gum

Doublemint Liked it better before they "improved" it a couple years ago.

Member Avatar for kal_crazy
0
170
Member Avatar for Xantipius

Even if it doesn't cure or prevent cancer, it makes life more interesting. Bring on the curry!

Member Avatar for jwenting
0
366
Member Avatar for Dannyo329

[QUOTE=RenjithVR;635734]you can use either cin.getline (name, '\n'); [/QUOTE] Oops - second parameter of the function is the size of destination array. If you want to use a (non-default) delimiter, you must still enter the array size. In your example, the getline would read in up the number of characters (less …

Member Avatar for Jamblaster
0
2K
Member Avatar for kayed.alsalim

Start by writing the code to read an input file. You can't really do anything else till that works. Decide if you want to read and store the whole file's worth of data, or read a line, process it, read the next... Show some work here, tell us what specific …

Member Avatar for vmanes
0
219
Member Avatar for you207

if(( a[i][j]>= k ) && ( a[i][j] <= l )){ c[z] = a[i][j] ; z++; you are only putting the values between k and l into the c[] array, which possibly (likely) leaves many elements of c[] still at their uninitialized state. If your display of c[] is limited by …

Member Avatar for vmanes
0
418
Member Avatar for k88joshi

Please show us what you've tried, and explain just what you're trying to accomplish. I could dust off my lecture, or you could do a little searching. Googling "c++ 2D dynamic array" brings up several hits that look helpful.

Member Avatar for cambalinho
0
744
Member Avatar for anga08628

[code] rnum = (rand() % 50) + 1; if (rnum>1 && rnum <100) [/code] this is not doing quite what you want. rnum will be in the range 1-50. Your if condition will fail on value 1, which should be legitimate. You're on the right track to get your 1-100 …

Member Avatar for irum.nageen.3
0
11K
Member Avatar for kenth21v

I'd take a higher throughput (CFM) over just higher speed fans. Larger fans can move more air at lower speeds, which makes them quieter for the same work. I've not looked at what's available in a long time, but I can attest to the usefullness of cooling pads. I had …

Member Avatar for ronald577
0
185
Member Avatar for daniel1977

You will need to write an override for == for your *extPersonType*, or revise your code to compare members of that type which are basic data types.

Member Avatar for daniel1977
0
361
Member Avatar for erinkay528

Care to describe what your problem is? What should output look like, and what is you're actually getting.

Member Avatar for JasonHippy
0
158
Member Avatar for TestAccount1
Member Avatar for gobiking

`maxValue(valArr[x],Size);//error here` You are passing a discrete value (an element of the array) to the function that is expecting the array iteself. Try `maxValue(valArr, Size);`

Member Avatar for gobiking
0
1K
Member Avatar for kamalashraf

You end the function with: y=y-1; cout<<y; float result; result=y; return (result); Your function is meant to return the solution, not display it, so you should remove the output statement. Secondly, why assign the value y to another variable, only to return that variable? How about, simply: y=y-1; return (y); …

Member Avatar for tinstaafl
0
270
Member Avatar for cproger
Member Avatar for breezett93

Your "indicator" is a single character, so why declare it as a string? Is it your intent that a user's message is just one line (no newlines)? If so, get an input then examine the first character of that to determine the processing needed. Something like if( input[0] == '#' …

Member Avatar for tinstaafl
0
226
Member Avatar for Xantipius

Like the story of the guy getting his physical exam. Asks the doctor, "will I live a long time?" Doctor: Do you smoke? Patient: No. D: Do you drink? P: No. D: Do you cavort with women? P: No. D: Then what the heck to you want to live a …

Member Avatar for Reverend Jim
0
1K
Member Avatar for mattster

Best? The one that's not causing me to pull out any more hair at the given moment. Overall, in the Windows camp I'd say Win7 is best of the lot. I like XP and have it on several boxes still (heck, I still have a Win98SE box in occaisional use). …

Member Avatar for Assembly Guy
0
857
Member Avatar for mudbubbleb

To increase (or decrease) the value stored in an array element, just do the math. int data[5] = { 1, 2, 3, 9, 10 }; data[0]++; //increases the value by 1 data[1] = data[1] + 5; //adds some number to the element data[2] += 10; //shortcut operator //array contents now: …

Member Avatar for vmanes
0
146
Member Avatar for russendel
Member Avatar for rubberman
0
126
Member Avatar for SpottyBlue

Looks right. Other than needing some `<< endl` and semicolons at the end our your output statements.

Member Avatar for tinstaafl
0
1K

The End.