Thread: Array Help.. DIFFICULT!

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    5

    Smile Array Help.. DIFFICULT!

    Create a c++ iostream that will let the user enter 10 numbers. Determine the highest number and display the difference from the highest number to the number being entered..





    #include <iostream>
    using namespace std;

    int main ()
    {
    double ave;
    ave/10


    cout << "Enter 10 integer numbers: ";
    cin>>x>[1];

    for (int i=0; i<n; i++) {
    sum = sum + a[i];


    system("PAUSE");
    return 0;


    it's not running..

  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    Fix your indenting and use the code tags, put something more descripitive than "Its not running", as your problem. Nobody is a crystal ball reader here, of course mistakes we can spot by taking time to read through the posted code, but then nobody is going to be very inclinded to do that if you do not have the grace to bother posting a better description yourself.

    ave/10
    what is that for? And apart from anything else there is no semicolon, other parts of the code show that you need to study the basic syntax of the language amigo.
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  3. #3
    Registered User
    Join Date
    Feb 2011
    Posts
    5
    I'm a newbie... I was just being registered just today...

    Please bear with me as I go along.. hehehe

  4. #4
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Now, really:
    Urgent!!! Please

    Your code is horrible. Like, NOTHING is right, which is quite impressive. The only part that makes sense tries to sum ALL the numbers, so undoubtedly you stole it from some place thinking it did something it didn't.
    I don't consider this "a try" of solving the problem. Do you know any C++ at all? You seem to have missed even the first lesson...

  5. #5
    Registered User
    Join Date
    Jan 2011
    Posts
    5
    i dont really understand your code..

    pls. read some basics in the faqs ..
    give it a try then we will edit some of your work...

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    The fact that you don't seem to have gasped the basis of the language doesn't bode well. You seem to be in the wrong mindset if you think you need to pass this ... test or whatever it is. You are not supposed to pass it. The end.
    You need to go back to basics.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Quote Originally Posted by EVOEx View Post
    Your code is horrible. Like, NOTHING is right, which is quite impressive.
    Well not 'nothing', he looks to have int main() right...

    But yes it looks like the "1 million monkeys on typewriters" approach to me. I.e. programming by writing things that look vaguely like code and expecting it to compile or actually do anything, which will never work. You actually have to learn how to do stuff.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  8. #8
    Registered User
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    733
    After this: Urgent!!! Please

    I must say that he just posted some random code only to get help and not get fired again.
    Last edited by kmdv; 02-28-2011 at 12:50 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. from 2D array to 1D array
    By cfdprogrammer in forum C Programming
    Replies: 17
    Last Post: 03-24-2009, 10:33 AM
  2. Replies: 7
    Last Post: 11-25-2008, 01:50 AM
  3. 1-D array
    By jack999 in forum C++ Programming
    Replies: 24
    Last Post: 05-12-2006, 07:01 PM
  4. Template Array Class
    By hpy_gilmore8 in forum C++ Programming
    Replies: 15
    Last Post: 04-11-2004, 11:15 PM
  5. two dimensional dynamic array?
    By ichijoji in forum C++ Programming
    Replies: 6
    Last Post: 04-14-2003, 04:27 PM