It looks like you're using an Ad Blocker.

Please white-list or disable in your ad-blocking tool.

Thank you.


Some features of ATS will be disabled while you continue to use an ad-blocker.


C++ homework help? ; )

page: 1

log in


posted on Nov, 30 2014 @ 03:33 PM
If there is anyone on here who can help me, a Mechanical Engineering student, with some c++ homework, would be appreciated.
I mostly want help with exercise A, but any guidance at all would be appreciated. I use Bloodshed's DEV C++ compiler. Thanks in advance.

Exercise A) RandomArray - Write a program that populates an integer array of size 100 with random numbers. The user should be prompted to choose the low and high numbers (inclusive) in the random number range. The program should display the contents of the array separated by a hyphen(-).

Example Output:
32 - 12 - 43 - 11...

Note: Your program should contain two separate loops: one loop for input and one for output.

Exercise B) LinearSearch - Write a program that populates a character array with 15 characters using an initializer list. Prompt the user for a search character. Your program should look through the array to see if the search character exists in the array. If the array contains the search character, then your program should display the index it was first found. If the array does not contain the search character, then the program should display "Character Not Found."

Exercise C) LongJumps - Write a program that uses an array to store 3 jumps taken in a meet by a Long Jumper (in meters). Using a loop prompt the user for the three jump distances. The program should use another loop to find the longest jump. The program should use a third loop to find the average jump. Display the longest jump and average jumps.
edit on 11/30/2014 by JamesCookieIII because: (no reason given)

posted on Nov, 30 2014 @ 04:37 PM
a reply to: JamesCookieIII

There is paid-homework-help all over the Internet for mechanical engineering. You might start with this one:

Good Luck!

posted on Nov, 30 2014 @ 05:32 PM
a reply to: JamesCookieIII

this is my source code below in the image. works well, so long as the lower bound is 0....
Also, I used only ONE loop, whereas the professor wants two separate loops for input and output. But that is neither here nor there : )

once compiled and the program is running, if i set lower bound to 0 and upper to 5, sure enough it spits out 100 random integer numbers from 0 to 5, formatted as required.

but if i set the lower bound to 9, and the upper to 12, it spits out numbers from 0 to 3 (the difference of the upper and lower bounds + 1).

What should my

myArray = (rand()% (upperBound-(lowerBound-1)+lowerBound))

line look like?
Should I change other lines of code?


edit on 11/30/2014 by JamesCookieIII because: (no reason given)

edit on 11/30/2014 by JamesCookieIII because: (no reason given)

posted on Nov, 30 2014 @ 05:35 PM

edit on 11/30/2014 by JamesCookieIII because: (no reason given)

posted on Nov, 30 2014 @ 06:02 PM
Oh... NVM folks, I got it to run right by making the output line in the for loop

myArray = lowerBound + (rand() % (int)(upperBound - lowerBound + 1));


posted on Nov, 30 2014 @ 06:04 PM
It's much more fun than the rest you have to study

The code
edit on 30-11-2014 by 4lk4tr43 because: code doesnt show

edit on 30-11-2014 by 4lk4tr43 because: smiley

edit on 30-11-2014 by 4lk4tr43 because: no more drunk

posted on Nov, 30 2014 @ 06:49 PM
a reply to: 4lk4tr43

Holy smokes you are a gangster! I believe you are in fact SO gangster that I might buy you a belt for Christmas (because your pants sag so much).



posted on Nov, 30 2014 @ 06:50 PM
a reply to: JamesCookieIII

Haaaaaaaa! Oh man! I really commend you in studying the subject! I haven't a clue....just wanted to tell you its great you're studying that....I just got a headache READING your questions!

Really great. Good luck in your studies!

posted on Nov, 30 2014 @ 07:20 PM
Don't drink to much, we need geeks like you to enslave the people of tomorrow
, btw check the code before you send it in (I dind't).

posted on Dec, 1 2014 @ 07:31 AM
I made a mistake it should be
int dice = array;

posted on May, 19 2016 @ 04:54 AM
I guess, having read a pile of other comments here, we were DOING stuff in the summer, but it was very much parent-driven. In my childhood (not THAT long ago), I had the incredible advantage of having both parents who had summer 'off' - they are both college professors and all the time were making me Do My Programming Homework (yes, I went into the family business). We went north of the city to a little cottage on a lake - no tv, no videos, no videogames, very limited computer time (it literally had to be taken out of the closet to be used!), no internet. They all existed, but when you're in the middle of the Canadian Shield, the only way to get it is satellite, and my parents presented it this way: it's going to cost X per month for satellite and internet, which means we can't do Y. Even as under 10s, that was pretty easy.

Instead we had water, canoes, frogs (a great little stream on the property), baseball on the radio, incredibly eclectic music on vinyl (everything from the Beatles to Black Sabbath with stops for pop folk, musicals and the top 40 of the past 40 years), 5 new books each (BIG trip to the bookstore before we left), two 'read-aloud' books (always novels, and one chapter a night - once you could read well, you got your turn reading aloud - A Wrinkle in Time anyone?) and cards, lots of cards. We played cribbage, and euchre, and a lot of poker for jelly beans. We learned to scorekeep baseball from the radio and to cook in the tiny kitchen. And along the way our literacy got better, our math got a lot better (cards are good for that) and we figured out the basics of science. Was it idyllic? No, we were still cranky and kids after all (especially when we were teens), but I'd say we didn't have a tonne of summer drop off either. Make it fun, don't make it work!

new topics

top topics


log in