It looks like you're using an Ad Blocker.

Please white-list or disable AboveTopSecret.com 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
1

log in

join
share:

posted on Nov, 30 2014 @ 03:33 PM
link   
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
link   
a reply to: JamesCookieIII

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


www.scholarsjunction.com...
C++ ONLINE TUTORING

Good Luck!



posted on Nov, 30 2014 @ 05:32 PM
link   
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?


HELP I'M A STARVING ENGINEERING STUDENT NO MONEY NO SOCIAL LIFE NO HOPE


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
link   

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



posted on Nov, 30 2014 @ 06:02 PM
link   
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));


wooohooo!



posted on Nov, 30 2014 @ 06:04 PM
link   
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
link   
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).

ATS FOR THE WIN,

COOKIE SOUNDING OFF TO GET DRUNK.




posted on Nov, 30 2014 @ 06:50 PM
link   
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
link   
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
link   
I made a mistake it should be
int dice = array;


(post by sandracortez removed for a serious terms and conditions violation)
(post by Kaitlyn removed for a serious terms and conditions violation)


top topics



 
1

log in

join