Thread: I want to write a Programm In C++ Please help?

  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    7

    I want to write a Programm In C++ Please help?

    1.) I want to use a void function that will populate an array by prompting the user for values, and storing them in the array.
    2.) I also want an int function that will find the minimum value in the array. I want the function to have that minimum value as its return value.
    3.) I also want a Boolean function that will prompt the user for a target value. I want the function to search the array to see if it contains the target value. If the target value is found, the function should return "true". If the function is not found, the funciton will return "false".
    4.) I also need a void function that will "process" the values in the array. The function will check each array value to see if it is even. If it is even, it will do nothing. However, if it is odd, it will multiply the value by two, and store the new value at the same index location.
    5.) I would also like a void function that will print the elements in the array.
    6.) I would really like if main () would do the following:
    a.) Declare an array with a maximum size of 50.
    b.) Prompt the user for the number of values he/she would like to enter, with the maximum being the length of the array.
    c.)Call the function (1) that populates the array. It should take as a parameter the value indicated by the user in b).
    d.) Call the print function (5) to output the values entered by the user.
    e.) Call the minimum function (2) and output the result.
    f.) Call the search function (3) and ouput the result. I would like it if it would have an if statement in main () in order to accomplish this.
    g.) Call the process function (4).
    h.) Call the print function (5) again to print the proccessed elements in the array.

    This may be way to easy for some of you and for others way to hard. I sure will be appretiative once I see the completed code. And to whoever happens to finish this first I would like to say thank you so much. I am trying to teach my self C++ with EBOOKS and this is one of the last code assignments in book 1. But they give no code until you buy book 2 and i am having touble with this one. I don't want to buy the other book I am going to go another route. Thanks again.

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Get off your lazy rear.

  3. #3
    Registered User
    Join Date
    Jul 2008
    Posts
    7
    It's not homework thanks for the lovely comment though. It's just an assignment in a purchased book and they want you topurchase the second one.
    Your all kinds of a nice guy though

  4. #4
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    For all intents and purposes it is homework. Just because some professors didn't order you to do it and it won't be graded doesn't change the fact that it's work for you to do in order to gain an understanding of how the language works, as well as increasing your skills as a programmer.

    For you to come here and demand that we do this for you is pure arrogance. Are you really that conceited to think that there's going to be a mad rush of people to write a program exactly as you specify it just because you don't have an answer to a homework question? Get real. Either do it yourself, and if you need some help, go ahead and post about trouble you are having with the language, or else purchase the book and get the answer.

    And btw, they don't pay me to be nice to people, just like you aren't getting paid to learn C++. Stop and think about why any of us should write out a program to the exact blueprint detail that you have outlined it. If you can write out specifications like that, either you copied it right from the book or you have an idea how the program should work and should be able to write it yourself.

    In order to learn a language, you have to practice it yourself. I suggest you get started if you want to take it seriously. Excuse my harshness, but if you want to become a good programmer, you better get serious.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Imagine that you want to become an author. You can't become an author by asking other people to write your essays at the school or writing, can you? [you may pass the grade that way, but you won't actually have learned the process of writing an article or a book].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    This is really becoming epidemic. How are people finding this site? Do professors link it in their syllabi?

  7. #7
    The larch
    Join Date
    May 2006
    Posts
    3,573
    How are people finding this site?
    I think they Google?
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  8. #8
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    I guess the real problem is that they google for a forum instead of a book.

  9. #9
    Registered User
    Join Date
    Jul 2008
    Posts
    7
    I'm not a student, I am a 30 year old with three children and a wife. I was simply trying to see what the code for the last progam entry assignment looked like because I didn't learn enough to accomplish it by myself not even close. I'm not asking for a hand out. I'm not cheating on anything and I wasn't looking for a book. All's I wanted to see was the code for that entry without having to spend the money on another book in that series, because I don't think it's mapped out well enough to get a basic understanding of C++ before you start hitting the harder stuff, such as this program. I don't understand why it's so difficult for you guys to understand that. I have no proffessor, no graded assignment, no nothing. I understood how you could describe it as homework even though it's not graded, but what I don't understand is why you guys have to be such jerks to someone who just asked a question. I didn't demand that you do it. I simply "ASKED". How hard is it to fathem that someone wants to learn something but doesn't have the capacity to do it on his own yet. If this is at all understandable I am more of a visual learner than a read and learn type of person. So the point of the request is to try and get a visual understanding of how that program works, whats entailed in the code, and how its mapped out to have a better understanding of functions, arrrays and items of that nature. I did just copy the text right out of the book, because if I tried to word it myself no one would probably understand what I was saying, because of the fact that I barely have an understanding of how this stuff works. I am trying to learn something to broaden my intellectual capacity without haveing to spend a ton of money. Anyone with any children would understand what I mean. And for you guys to just bash on me like that is, I guess crazy because I don't understand why you have to be so mean. I'm not telling you have to do it, I just was asking and I guess hoping someone would be nice enough to help me try and learn how things work in C++. I am guessing that this isn't to difficult because it was in a beginners book, but you guys make it seem like I have committed a crime here. I'm sorry that I somehow upset you guys for some reason I guess I'll never understand. I'm sorry if you feel like I am cheating in some way or another. But the basic truth is, I'm just a married father of three, trying to broaden my horizons for my family, and If no one wanted to help they just could have said read some more books or keep trying and let us know if we can help. I'm sorry I don't have the expertise level of you guys when it comes to programming in C++, but I'm trying and I want to learn, but like I said I get a better understanding for things when I can see them. For example, math out of a book is hard for me, but show me visually a problem or a formula and how it is woked, I'll never forget it. Sorry guys I'll just leave your site alone and if I ever have a question in the future I'll look somewhere else. Thanks!

  10. #10
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> I don't understand why it's so difficult for you guys to understand that.
    Many of the questions asked here are from students working on graded assignments. There are quite a few who simply post the assignment and expect (or hope for) the work to be done for them. That is why many are skeptical for requests for an entire assignment to be completed.

    In addition, all we have is your word that this isn't homework. Whether we believe you or not is hardly relevant. This forum does not provide full answers to homework, and that means we have to be wary of any request that could be homework.

    >> Sorry guys I'll just leave your site alone and if I ever have a question in the future I'll look somewhere else.
    First, judging the forum by the first couple responses might be a mistake. Chances are you'll get similar responses elsewhere, although the rudeness/harshness varies.

    If you'd like help on this problem, your best bet is to post what you've tried even if it isn't anywhere close to a solution. Start with a small part of the problem where you are having particular difficulty and ask a specific question. It might take longer to get where you're going, but you might also learn more and we won't be as worried about providing a full homework solution.

  11. #11
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Oh, I know, how about formatting English.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  12. #12
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Hmm, this sounds familiar:

    Quote Originally Posted by Dobber3333
    I really need visual studio 2008, or 2005, or 2003, I really don't care. I am running vista 32bit on an XPS 1730 Gaming rig with the best features money can buy, so I hope that I don't need to list them. I need this application for college work for program writting in C++, so its very important. Every time I try an instal at one point or another it tells me that I am missing a important componet in order to install and it's windows XP service pack 3 and I'm running vista. It will not let me install. I would really rather have 2008 but im willing to take what i can get. If anyone can help Im really at a loss for words here ohter than what i have put here. I did once try virtual pc and install xp on there and run visual studio but every time i would try and compile and run it would tell me that i have chosen an invalid save location please select another and no matter where i saved to it would tell me the same. So I ditched that plan. Please help.

  13. #13
    3735928559
    Join Date
    Mar 2008
    Location
    RTP
    Posts
    838
    if you're new to programming you might consider trying something like PHP first. their documentation has example code for EVERYTHING. it's also untyped and doesn't require the same level of pedantry that C++ does. a lot of the syntax is very similar, so transitioning to a more grammatically/syntactically demanding language like C++ would probably be easier.

    that said, try posting an attempt (don't worry about how wrong it is) at any of the above items and you'll get some help. don't worry about doing it all right now, just worry about getting one function at a time.

    i totally sympathize with the idea of trying to learn any kind of code without examples to follow. that would be utterly hellish.

    the main site for this forum has pretty decent tutorials (with example code) here:

    http://www.cprogramming.com/tutorial.html

    good luck, and don't get discouraged.

  14. #14
    Registered User
    Join Date
    Jul 2008
    Posts
    34
    ouch MacGyver delivers the final blow

  15. #15
    Registered User
    Join Date
    Jul 2008
    Posts
    7
    I don't care what you guys say that post I just submitted for the first time and I had to sign up for to post a message I made up this name from a game name I saw once. You can believe what you want but I am not a college student. I will submit some code I am working on. If you notice I have only been a member for a week or so. So believe what you want, Im sure this isn't the first time this name has been used. I tried to just use dobber but that didn't work so I kept adding threes because its my favorite number.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 03-18-2006, 11:25 AM
  2. program to make a floppy write protected
    By shrijeetp in forum C Programming
    Replies: 1
    Last Post: 10-03-2005, 06:00 AM
  3. Reroute where programs write to
    By willc0de4food in forum C Programming
    Replies: 7
    Last Post: 09-21-2005, 04:48 PM
  4. Function to write string 3 times
    By Giggs in forum C++ Programming
    Replies: 15
    Last Post: 12-24-2002, 04:00 PM
  5. write in c
    By PutoAmo in forum C Programming
    Replies: 6
    Last Post: 04-03-2002, 07:53 PM